]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ocfs2: Add a missing journal credit in ocfs2_link_credits() -v2
authorXiaowei.Hu <xiaowei.hu@oracle.com>
Wed, 19 Oct 2011 01:34:19 +0000 (09:34 +0800)
committerXiaowei.Hu <xiaowei.hu@oracle.com>
Wed, 29 Aug 2012 06:09:05 +0000 (14:09 +0800)
commitcf5f6b24eee9ab90fd1649208d98bd69f76c1d73
treea8047e080d8c79dd5156847c672923d114f3c928
parent9e0368d92447de05229f95739d25e7324e7c2359
ocfs2: Add a missing journal credit in ocfs2_link_credits() -v2

With indexed_dir enabled, ocfs2 maintains a list of dirblocks having
space.

The credit calculation in ocfs2_link_credits() did not correctly account
for adding an entry that exactly fills a dirblock that triggers removing
that dirblock by changing the pointer in the previous block in the list.
The credit calculation did not account for that previous block.

To expose, do:

mkfs.ocfs2 -b 512 -M local /dev/sdX
mount /dev/sdX /ocfs2
mkdir /ocfs2/linkdir
touch /ocfs2/linkdir/file1
for i in `seq 1 29` ; do link /ocfs2/linkdir/file1
/ocfs2/linkdir/linklinklinklinklinklink$i; done
rm -f /ocfs2/linkdir/linklinklinklinklinklink10
sleep 8
link /ocfs2/linkdir/file1
/ocfs2/linkdir/linklinklinklinklinklinkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Note:
The link names have been crafted for a 512 byte blocksize. Reproducing
with a larger blocksize will require longer (or more) links. The sleep
is important. We want jbd2 to commit the transaction so that the missing
block does not piggy back on account of the previous transaction.

Signed-off-by: XiaoweiHu <xiaowei.hu at oracle.com>
Reviewed-by: WengangWang <wen.gang.wang at oracle.com>
Reviewed-by: Sunil.Mushran <sunil.mushran at oracle.com>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
(cherry picked from commit 0393afea31874947b1d149b82d17b7dccac4f210)

Signed-off-by: Xiaowei.Hu <xiaowei.hu@oracle.com>
fs/ocfs2/journal.h