Message ID | 1354246809-32339-2-git-send-email-filbranden@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Nov 29, 2012 at 07:40:08PM -0800, Filipe Brandenburger wrote: > When a new file is created with btrfs_create(), the inode will initially be > created with permissions 0666 and later on in btrfs_init_acl() it will be > adapted to mask out the umask bits. The problem is that this change won't make > it into the btrfs_inode unless there's another change to the inode (e.g. writing > content changing the size or touching the file changing the mtime.) > > This fix adds a call to btrfs_update_inode() to btrfs_create() to make sure that > the change will not get lost if the in-memory inode is flushed before other > changes are made to the file. > Looks good to me. Reviewed-by: Liu Bo <bo.li.liu@oracle.com> thanks, liubo > Signed-off-by: Filipe Brandenburger <filbranden@google.com> > --- > fs/btrfs/inode.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 95542a1..caf9d76 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -4996,6 +4996,12 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, > goto out_unlock; > } > > + err = btrfs_update_inode(trans, root, inode); > + if (err) { > + drop_inode = 1; > + goto out_unlock; > + } > + > /* > * If the active LSM wants to access the inode during > * d_instantiate it needs these. Smack checks to see > -- > 1.7.11.7 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Any concerns on this patchset? Any chance it can be integrated in time for 3.8 or too risky for it? The Bugzilla entry contains some test cases that reproduce the issue fairly easily by unmounting the filesystem right after creating an empty file... Let me know if there are any extra fixes or tests you'd like me to provide. Thanks, Filipe On Thu, Nov 29, 2012 at 7:40 PM, Filipe Brandenburger <filbranden@google.com> wrote: > When a new file is created with btrfs_create(), the inode will initially be > created with permissions 0666 and later on in btrfs_init_acl() it will be > adapted to mask out the umask bits. The problem is that this change won't make > it into the btrfs_inode unless there's another change to the inode (e.g. writing > content changing the size or touching the file changing the mtime.) > > This fix adds a call to btrfs_update_inode() to btrfs_create() to make sure that > the change will not get lost if the in-memory inode is flushed before other > changes are made to the file. > > Signed-off-by: Filipe Brandenburger <filbranden@google.com> > --- > fs/btrfs/inode.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 95542a1..caf9d76 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -4996,6 +4996,12 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, > goto out_unlock; > } > > + err = btrfs_update_inode(trans, root, inode); > + if (err) { > + drop_inode = 1; > + goto out_unlock; > + } > + > /* > * If the active LSM wants to access the inode during > * d_instantiate it needs these. Smack checks to see > -- > 1.7.11.7 > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 95542a1..caf9d76 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4996,6 +4996,12 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, goto out_unlock; } + err = btrfs_update_inode(trans, root, inode); + if (err) { + drop_inode = 1; + goto out_unlock; + } + /* * If the active LSM wants to access the inode during * d_instantiate it needs these. Smack checks to see
When a new file is created with btrfs_create(), the inode will initially be created with permissions 0666 and later on in btrfs_init_acl() it will be adapted to mask out the umask bits. The problem is that this change won't make it into the btrfs_inode unless there's another change to the inode (e.g. writing content changing the size or touching the file changing the mtime.) This fix adds a call to btrfs_update_inode() to btrfs_create() to make sure that the change will not get lost if the in-memory inode is flushed before other changes are made to the file. Signed-off-by: Filipe Brandenburger <filbranden@google.com> --- fs/btrfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)