From: Rachita Kothiyal Date: Sun, 18 May 2008 07:19:33 +0000 (-0400) Subject: Unionfs ODF: Move around locking order in unions_readdir() X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=0cba0e777b2bc0b09b422c25f74605bc364264ec;p=unionfs-odf.git Unionfs ODF: Move around locking order in unions_readdir() Signed-off-by: Rachita Kothiyal --- diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c index ca49ad1b42..3926972f2a 100644 --- a/fs/unionfs/dirfops.c +++ b/fs/unionfs/dirfops.c @@ -38,7 +38,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) err = unionfs_file_revalidate(file, false); if (unlikely(err)) - goto out; + goto out_unlock; inode = dentry->d_inode; @@ -48,7 +48,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) if (IS_ERR(odf_cache)) { err = PTR_ERR(odf_cache); odf_cache = NULL; - goto out; + goto out_unlock; } /* check if cached dir does not exist */ @@ -61,7 +61,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) err = odf_cache_dir(file->f_path.dentry, odf_cache, &file->f_path.dentry->d_inode->i_mtime); if (err) - goto out; + goto out_unlock; /* * Reset file position, since an operation like rm * @@ -71,6 +71,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) */ file->f_pos = 0; } + unionfs_unlock_dentry(dentry); dget(odf_cache); mntget(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.path.mnt); @@ -123,12 +124,15 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir) if (file->f_pos >= size) file->f_pos = DIREOF; + goto out; + +out_unlock: + unionfs_unlock_dentry(dentry); out: kfree(name); if (odf_file) filp_close(odf_file, NULL); dput(odf_cache); - unionfs_unlock_dentry(dentry); unionfs_read_unlock(dentry->d_sb); return err; }