summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim2013-08-12 09:04:53 +0200
committerJaegeuk Kim2013-08-12 09:04:53 +0200
commit479bd73ac425ff117efeea051077b4277baab52e (patch)
treea078a20d6d657f4b77140392be5a6316c96110a3 /fs/f2fs/node.c
parentf2fs: check the free space first in new_node_page (diff)
downloadkernel-qcow2-linux-479bd73ac425ff117efeea051077b4277baab52e.tar.gz
kernel-qcow2-linux-479bd73ac425ff117efeea051077b4277baab52e.tar.xz
kernel-qcow2-linux-479bd73ac425ff117efeea051077b4277baab52e.zip
f2fs: should cover i_xattr_nid with its xattr node page lock
Previously, f2fs_setxattr assigns i_xattr_nid in the inode page inconsistently. The scenario is: = Thread 1 = = Thread 2 = = fi->i_xattr_nid = = on-disk nid = f2fs_setxattr 0 0 new_node_page X 0 sync_inode_page X X checkpoint X X -. grab_cache_page X X | --> allocate a new xattr node block or -ENOSPC <----------------' At this moment, the checkpoint stores inconsistent data where the inode has i_xattr_nid but actual xattr node block is not allocated yet. So, we should assign the real i_xattr_nid only after its xattr node block is allocated. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 858a333f6ab9..1c21344fba30 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -851,6 +851,9 @@ struct page *new_node_page(struct dnode_of_data *dn,
SetPageUptodate(page);
set_page_dirty(page);
+ if (ofs == XATTR_NODE_OFFSET)
+ F2FS_I(dn->inode)->i_xattr_nid = dn->nid;
+
dn->node_page = page;
if (ipage)
update_inode(dn->inode, ipage);