CEPH filesystem development
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: ceph-devel@vger.kernel.org, sage@inktank.com
Subject: Re: [PATCH 4/5] ceph: add missing init_acl() for mkdir() and atomic_open()
Date: Fri, 14 Feb 2014 14:07:56 +0800	[thread overview]
Message-ID: <52FDB2BC.2020000@intel.com> (raw)
In-Reply-To: <20140214054649.GA3488@x230>

On 02/14/2014 01:46 PM, Guangliang Zhao wrote:
> On Tue, Feb 11, 2014 at 01:30:11PM +0800, Yan Zheng wrote:
> 
> This looks good, but there maybe some hiccups, see below.
> 
> The symlink also need ceph_init_acl() as Alex mentioned, I have
> add it in the patch.

will update my patch. 

> 
>> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
>> ---
>>  fs/ceph/dir.c  | 9 +++++----
>>  fs/ceph/file.c | 1 +
>>  2 files changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
>> index 6da4df8..3bbd0eb 100644
>> --- a/fs/ceph/dir.c
>> +++ b/fs/ceph/dir.c
>> @@ -695,9 +695,8 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
>>  	ceph_mdsc_put_request(req);
>>  
>>  	if (!err)
>> -		err = ceph_init_acl(dentry, dentry->d_inode, dir);
>> -
>> -	if (err)
>> +		ceph_init_acl(dentry, dentry->d_inode, dir);
>> +	else
>>  		d_drop(dentry);
> 
> ceph_init_acl() may fail, we shoud take care of the return value.

I remove the error handling intentionally because creating inode and initializing
ACL are not atomic in current implementation. A better approach is initializing the
ACL on the metadata server, but it requires more works.

Regards
Yan, Zheng

> 
>>  	return err;
>>  }
>> @@ -776,7 +775,9 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
>>  		err = ceph_handle_notrace_create(dir, dentry);
>>  	ceph_mdsc_put_request(req);
>>  out:
>> -	if (err < 0)
>> +	if (!err)
>> +		ceph_init_acl(dentry, dentry->d_inode, dir);
>> +	else
>>  		d_drop(dentry);
>>  	return err;
>>  }
>> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
>> index dfd2ce3..09c7afe 100644
>> --- a/fs/ceph/file.c
>> +++ b/fs/ceph/file.c
>> @@ -286,6 +286,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
>>  	} else {
>>  		dout("atomic_open finish_open on dn %p\n", dn);
>>  		if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
>> +			ceph_init_acl(dentry, dentry->d_inode, dir);
> 
> Same to above.
> 
>>  			*opened |= FILE_CREATED;
>>  		}
>>  		err = finish_open(file, dentry, ceph_open, opened);
>> -- 
>> 1.8.5.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2014-02-14  6:07 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 [this message]
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
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=52FDB2BC.2020000@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.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