lkml.org 
[lkml]   [2015]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Can ovl_drop_write() be called earlier in ovl_dentry_open()
From
On Mon, Jun 1, 2015 at 3:52 PM, David Howells <dhowells@redhat.com> wrote:
> In ovl_dentry_open(), ovl_drop_write() is called after vfs_open() - but is
> this actually necessary? Can't we just drop it post-copyup? After all,
> that's all we wanted the write lock for, right?

Hmm, that could result in a race where remount r/o of upper fs comes
in between copy-up and vfs_open() so copy-up succeeds but the actual
open fails. It's harmless, though, and not very likely. So I guess
your patch is OK.

Thanks,
Miklos




>
> David
> ---
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -356,16 +356,14 @@ static int ovl_dentry_open(struct dentry *dentry, struct inode *inode,
> err = ovl_copy_up_last(dentry, NULL, true);
> else
> err = ovl_copy_up(dentry);
> + ovl_drop_write(dentry);
> if (err)
> - goto out_drop_write;
> + goto out;
>
> ovl_path_upper(dentry, &realpath);
> }
>
> err = vfs_open(&realpath, d_backing_inode(realpath.dentry), file, cred);
> -out_drop_write:
> - if (want_write)
> - ovl_drop_write(dentry);
> out:
> return err;
> }


\
 
 \ /
  Last update: 2015-06-01 16:41    [W:0.054 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site