lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e77d268e129b8002e894fc7c16ae0e2faa1cd8dd.camel@ibm.com>
Date: Fri, 21 Feb 2025 01:48:10 +0000
From: Viacheslav Dubeyko <Slava.Dubeyko@....com>
To: "brauner@...nel.org" <brauner@...nel.org>,
        "neilb@...e.de"
	<neilb@...e.de>,
        "idryomov@...il.com" <idryomov@...il.com>,
        Xiubo Li
	<xiubli@...hat.com>, Olga Kornievskaia <okorniev@...hat.com>,
        "Dai.Ngo@...cle.com" <Dai.Ngo@...cle.com>,
        "johannes@...solutions.net"
	<johannes@...solutions.net>,
        "chuck.lever@...cle.com"
	<chuck.lever@...cle.com>,
        "anna@...nel.org" <anna@...nel.org>,
        "jlayton@...nel.org" <jlayton@...nel.org>,
        "miklos@...redi.hu"
	<miklos@...redi.hu>,
        "trondmy@...nel.org" <trondmy@...nel.org>,
        "anton.ivanov@...bridgegreys.com" <anton.ivanov@...bridgegreys.com>,
        "jack@...e.cz" <jack@...e.cz>, "richard@....at" <richard@....at>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "tom@...pey.com"
	<tom@...pey.com>,
        "senozhatsky@...omium.org" <senozhatsky@...omium.org>
CC: "ceph-devel@...r.kernel.org" <ceph-devel@...r.kernel.org>,
        "netfs@...ts.linux.dev" <netfs@...ts.linux.dev>,
        "linux-nfs@...r.kernel.org"
	<linux-nfs@...r.kernel.org>,
        "linux-fsdevel@...r.kernel.org"
	<linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>,
        "linux-um@...ts.infradead.org"
	<linux-um@...ts.infradead.org>,
        "linux-cifs@...r.kernel.org"
	<linux-cifs@...r.kernel.org>
Subject: Re:  [PATCH 3/6] ceph: return the correct dentry on mkdir

On Fri, 2025-02-21 at 10:36 +1100, NeilBrown wrote:
> ceph already splices the correct dentry (in splice_dentry()) from the
> result of mkdir but does nothing more with it.
> 
> Now that ->mkdir can return a dentry, return the correct dentry.
> 
> Signed-off-by: NeilBrown <neilb@...e.de>
> ---
>  fs/ceph/dir.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 39e0f240de06..c1a1c168bb27 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -1099,6 +1099,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
>  	struct ceph_client *cl = mdsc->fsc->client;
>  	struct ceph_mds_request *req;
>  	struct ceph_acl_sec_ctx as_ctx = {};
> +	struct dentry *ret = NULL;

I believe that it makes sense to initialize pointer by error here and always
return ret as output. If something goes wrong in the logic, then we already have
error.

>  	int err;
>  	int op;
>  
> @@ -1166,14 +1167,20 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
>  	    !req->r_reply_info.head->is_dentry)
>  		err = ceph_handle_notrace_create(dir, dentry);
>  out_req:
> +	if (!err && req->r_dentry != dentry)
> +		/* Some other dentry was spliced in */
> +		ret = dget(req->r_dentry);
>  	ceph_mdsc_put_request(req);
>  out:
>  	if (!err)
> +		/* Should this use 'ret' ?? */

Could we make a decision should or shouldn't? :)
It looks not good to leave this comment instead of proper implementation. Do we
have some obstacles to make this decision?

>  		ceph_init_inode_acls(d_inode(dentry), &as_ctx);
>  	else
>  		d_drop(dentry);
>  	ceph_release_acl_sec_ctx(&as_ctx);
> -	return ERR_PTR(err);
> +	if (err)
> +		return ERR_PTR(err);
> +	return ret;

What's about this?

return err ? ERR_PTR(err) : ret;

Thanks,
Slava.

>  }
>  
>  static int ceph_link(struct dentry *old_dentry, struct inode *dir,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ