linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com, Mark Fasheh <mfasheh@suse.com>,
	reiserfs-devel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	linux-mtd@lists.infradead.org, viro@zeniv.linux.org.uk,
	jfs-discussion@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-nfs@vger.kernel.org, linux-btrfs@vger.kernel.org,
	Joel Becker <jlbec@evilplan.org>
Subject: Re: [PATCH 12/18] ocfs2: use generic posix ACL infrastructure
Date: Tue, 3 Dec 2013 00:00:07 +0100	[thread overview]
Message-ID: <20131202230007.GK12253@quack.suse.cz> (raw)
In-Reply-To: <20131201120655.852590677@bombadil.infradead.org>

On Sun 01-12-13 03:59:15, Christoph Hellwig wrote:
> This contains some major refactoring for the create path so that
> inodes are created with the right mode to start with instead of
> fixing it up later.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
...
> -int ocfs2_acl_chmod(struct inode *inode)
> -{
> -	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> -	struct posix_acl *acl;
> -	int ret;
> -
> -	if (S_ISLNK(inode->i_mode))
> -		return -EOPNOTSUPP;
> -
> -	if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
> -		return 0;
> -
> -	acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
> -	if (IS_ERR(acl) || !acl)
> -		return PTR_ERR(acl);
> -	ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
> -	if (ret)
> -		return ret;
> -	ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
> -			    acl, NULL, NULL);
> -	posix_acl_release(acl);
> -	return ret;
> -}
...

> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 6fff128..ac371ad 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1236,7 +1236,7 @@ bail:
>  		dqput(transfer_to[qtype]);
>  
>  	if (!status && attr->ia_valid & ATTR_MODE) {
> -		status = ocfs2_acl_chmod(inode);
> +		status = posix_acl_chmod(inode);
>  		if (status < 0)
>  			mlog_errno(status);
>  	}
  Hum, this changes the cluster locking. Previously ocfs2_acl_get() used
from ocfs2_acl_chmod() grabbed cluster wide inode lock. Now getting of ACL
isn't protected by the inode lock. That being said the cluster locking
around setattr looks fishy anyway - if two processes on different
nodes are changing attributes of the same file, changing ACLs post fact
after dropping inode lock could cause interesting effects. Also I'm
wondering how inode_change_ok() can ever be safe without holding inode
lock... Until we grab that other node is free to change e.g. owner of the
inode thus leading even to security implications. But maybe I'm missing
something. Mark, Joel?

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2013-12-02 23:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-01 11:59 [PATCH 00/18] Consolidate Posix ACL implementation Christoph Hellwig
2013-12-01 11:59 ` [PATCH 01/18] reiserfs: prefix ACL symbols with reiserfs_ Christoph Hellwig
2013-12-02 20:15   ` Jan Kara
2013-12-01 11:59 ` [PATCH 02/18] fs: add get_acl helper Christoph Hellwig
2013-12-02 20:14   ` Jan Kara
2013-12-01 11:59 ` [PATCH 03/18] fs: add a set_acl inode operation Christoph Hellwig
2013-12-02 20:57   ` Jan Kara
2013-12-01 11:59 ` [PATCH 04/18] fs: add generic xattr_acl handlers Christoph Hellwig
2013-12-02 20:59   ` Jan Kara
2013-12-01 11:59 ` [PATCH 05/18] fs: make posix_acl_chmod more useful Christoph Hellwig
2013-12-02 21:09   ` Jan Kara
2013-12-01 11:59 ` [PATCH 06/18] fs: make posix_acl_create " Christoph Hellwig
2013-12-02 21:11   ` Jan Kara
2013-12-01 11:59 ` [PATCH 07/18] btrfs: use generic posix ACL infrastructure Christoph Hellwig
2013-12-01 11:59 ` [PATCH 08/18] ext2/3/4: " Christoph Hellwig
2013-12-02 22:13   ` Jan Kara
2013-12-01 11:59 ` [PATCH 09/18] f2fs: " Christoph Hellwig
2013-12-06  1:37   ` Jaegeuk Kim
2013-12-08  9:14     ` Christoph Hellwig
2013-12-08 23:28       ` Jaegeuk Kim
2013-12-01 11:59 ` [PATCH 10/18] hfsplus: " Christoph Hellwig
2013-12-01 14:36   ` Vyacheslav Dubeyko
2013-12-01 11:59 ` [PATCH 11/18] jffs2: " Christoph Hellwig
2013-12-01 11:59 ` [PATCH 12/18] ocfs2: " Christoph Hellwig
2013-12-02 23:00   ` Jan Kara [this message]
2013-12-03 10:48     ` Christoph Hellwig
2013-12-01 11:59 ` [PATCH 13/18] reiserfs: " Christoph Hellwig
2013-12-02 22:17   ` Jan Kara
2013-12-01 11:59 ` [PATCH 14/18] xfs: " Christoph Hellwig
2013-12-02 23:34   ` Dave Chinner
2013-12-01 11:59 ` [PATCH 15/18] jfs: " Christoph Hellwig
2013-12-02 22:11   ` [Jfs-discussion] " Dave Kleikamp
2013-12-01 11:59 ` [PATCH 16/18] gfs2: " Christoph Hellwig
2013-12-04 12:12   ` [Cluster-devel] " Steven Whitehouse
2013-12-06 19:47     ` Christoph Hellwig
2013-12-01 11:59 ` [PATCH 17/18] nfs: use generic posix ACL infrastructure for v3 Posix ACLs Christoph Hellwig
2013-12-01 11:59 ` [PATCH 18/18] fs: remove generic_acl Christoph Hellwig
2013-12-05 17:57 ` [PATCH 00/18] Consolidate Posix ACL implementation Andreas Gruenbacher
2013-12-06 19:46   ` Christoph Hellwig
2013-12-11 10:42 [PATCH 00/18] Consolidate Posix ACL implementation V2 Christoph Hellwig
2013-12-11 10:42 ` [PATCH 12/18] ocfs2: use generic posix ACL infrastructure Christoph Hellwig

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=20131202230007.GK12253@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=cluster-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=jlbec@evilplan.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xfs@oss.sgi.com \
    /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).