All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: "Yan, Zheng" <zheng.z.yan@intel.com>, ceph-devel@vger.kernel.org
Cc: sage@inktank.com
Subject: Re: [PATCH 5/5] ceph: fix ceph_set_acl()
Date: Tue, 11 Feb 2014 12:06:25 -0600	[thread overview]
Message-ID: <52FA66A1.9010806@ieee.org> (raw)
In-Reply-To: <1392096612-11481-5-git-send-email-zheng.z.yan@intel.com>

On 02/10/2014 11:30 PM, Yan, Zheng wrote:
> If acl is equivalent to file mode permission bits, ceph_set_acl()
> needs to remove any existing acl xattr. Use __ceph_setxattr() to
> handle both setting and removing acl xattr cases, it doesn't return
> -ENODATA when there is no acl xattr.

This looks good, however (continuing with our other
discussion) I assume that __set_xattr() will use a
null value rather than 0 value_len to determine whether
to remove the xattr.

And I'll continue to suggest better descriptions.  (I
realize English is not your native language but I
really think the description is important, to be
able to verify the code change matches what the
developer intended it to do.)  The problem here is
that ceph_set_acl() could return -ENODATA if it
attempted to remove a non-existent ACL attribute,
and that shouldn't happen.   (Right?)

Reviewed-by: Alex Elder <elder@linaro.org>

PS  Note that ceph_set_acl() can be made static, and its
    only caller, ceph_init_acl() has its return value
    ignored in all cases.  So in some respects this change
    not matter much.

> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
>  fs/ceph/acl.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
> index 4c2d452..accc9f2 100644
> --- a/fs/ceph/acl.c
> +++ b/fs/ceph/acl.c
> @@ -160,11 +160,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
>  			goto out_dput;
>  	}
>  
> -	if (value)
> -		ret = __ceph_setxattr(dentry, name, value, size, 0);
> -	else
> -		ret = __ceph_removexattr(dentry, name);
> -
> +	ret = __ceph_setxattr(dentry, name, value, size, 0);
>  	if (ret) {
>  		if (new_mode != old_mode) {
>  			newattrs.ia_mode = old_mode;
> 


  reply	other threads:[~2014-02-11 18:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11  5:30 [PATCH 1/5] ceph: properly handle XATTR_CREATE and XATTR_REPLACE Yan, Zheng
2014-02-11  5:30 ` [PATCH 2/5] ceph: remove zero-size xattr Yan, Zheng
2014-02-11 14:47   ` Alex Elder
2014-02-11 15:10     ` Yan, Zheng
2014-02-11 17:25       ` Alex Elder
2014-02-12  2:37         ` Yan, Zheng
2014-02-12  2:43           ` Sage Weil
2014-02-12  2:46             ` Yan, Zheng
2014-02-11  5:30 ` [PATCH 3/5] ceph: fix ceph_removexattr() Yan, Zheng
2014-02-11 14:50   ` Alex Elder
2014-02-11  5:30 ` [PATCH 4/5] ceph: add missing init_acl() for mkdir() and atomic_open() Yan, Zheng
2014-02-11 17:45   ` Alex Elder
2014-02-14  5:46   ` Guangliang Zhao
2014-02-14  6:07     ` Yan, Zheng
2014-02-14  6:12     ` Yan, Zheng
2014-02-14 13:08       ` Alex Elder
2014-02-11  5:30 ` [PATCH 5/5] ceph: fix ceph_set_acl() Yan, Zheng
2014-02-11 18:06   ` Alex Elder [this message]
2014-02-11 14:36 ` [PATCH 1/5] ceph: properly handle XATTR_CREATE and XATTR_REPLACE Alex Elder

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=52FA66A1.9010806@ieee.org \
    --to=elder@ieee.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    --cc=zheng.z.yan@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.