This fixes locking requirements in the function recover_dentry to properly lock the critical region between the labels retry and out with the read/write semaphone of the f2fs's superblock representation in order to protect against other concurrent threads of execution accessing the same regions of memory used by the code in this critical
Signed-off-by: Nicholas Krause <[email protected]> --- fs/f2fs/recovery.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index faec2ca..5f1226c 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -75,6 +75,7 @@ static int recover_dentry(struct inode *inode, struct page *ipage) struct qstr name; struct page *page; struct inode *dir, *einode; + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); int err = 0; dir = f2fs_iget(inode->i_sb, pino); @@ -97,6 +98,7 @@ static int recover_dentry(struct inode *inode, struct page *ipage) goto out_err; } retry: + f2fs_lock_op(sbi); de = f2fs_find_entry(dir, &name, &page); if (de && inode->i_ino == le32_to_cpu(de->ino)) goto out_unmap_put; @@ -117,6 +119,7 @@ retry: } f2fs_delete_entry(de, page, dir, einode); iput(einode); + f2fs_unlock_op(sbi); goto retry; } err = __f2fs_add_link(dir, &name, inode, inode->i_ino, inode->i_mode); @@ -138,6 +141,7 @@ out_unmap_put: out_err: iput(dir); out: + f2fs_unlock_op(sbi); f2fs_msg(inode->i_sb, KERN_NOTICE, "%s: ino = %x, name = %s, dir = %lx, err = %d", __func__, ino_of_node(ipage), raw_inode->i_name, -- 2.1.4 ------------------------------------------------------------------------------ _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
