From: Liu Bo <bo.li.liu@oracle.com>
To: Filipe Brandenburger <filbranden@google.com>
Cc: Chris Mason <chris.mason@fusionio.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] Btrfs: fix permissions of empty files not affected by umask
Date: Fri, 30 Nov 2012 14:17:14 +0800 [thread overview]
Message-ID: <20121130061714.GA2613@liubo.cn.oracle.com> (raw)
In-Reply-To: <1354246809-32339-2-git-send-email-filbranden@google.com>
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/
next prev parent reply other threads:[~2012-11-30 6:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 3:40 [PATCH 0/2] Btrfs: fix mode umasking on empty files Filipe Brandenburger
2012-11-30 3:40 ` [PATCH 1/2] Btrfs: fix permissions of empty files not affected by umask Filipe Brandenburger
2012-11-30 3:40 ` [PATCH 2/2] Btrfs: refactor error handling to drop inode in btrfs_create() Filipe Brandenburger
2012-11-30 6:17 ` Liu Bo [this message]
2012-12-04 7:05 ` [PATCH 1/2] Btrfs: fix permissions of empty files not affected by umask Filipe Brandenburger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121130061714.GA2613@liubo.cn.oracle.com \
--to=bo.li.liu@oracle.com \
--cc=chris.mason@fusionio.com \
--cc=filbranden@google.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).