mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "jack@suse.cz" <jack@suse.cz>,
	"brauner@kernel.org" <brauner@kernel.org>,
	"neil@brown.name" <neil@brown.name>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	Alex Markuze <amarkuze@redhat.com>,
	"zenghongling@kylinos.cn" <zenghongling@kylinos.cn>,
	"idryomov@gmail.com" <idryomov@gmail.com>,
	"jlayton@kernel.org" <jlayton@kernel.org>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"zhongling0719@126.com" <zhongling0719@126.com>
Subject: Re:  [PATCH] ceph: Fix ERR_PTR(0) in ceph_mkdir()
Date: Wed, 20 May 2026 18:49:18 +0000	[thread overview]
Message-ID: <d2cd070ded01305414815248032bbfc331c392ee.camel@ibm.com> (raw)
In-Reply-To: <20260520095428.69422-1-zenghongling@kylinos.cn>

On Wed, 2026-05-20 at 17:54 +0800, Hongling Zeng wrote:
> When mkdir succeeds, ceph_mkdir() sets ret to ERR_PTR(0) which is
> incorrect. It should return NULL instead for success.
> 
> Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>  fs/ceph/dir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index bac9cfb6b982..ab7f7b7016c6 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -1167,7 +1167,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
>  	    !req->r_reply_info.head->is_target &&
>  	    !req->r_reply_info.head->is_dentry)
>  		err = ceph_handle_notrace_create(dir, dentry);
> -	ret = ERR_PTR(err);
> +	ret = err ? ERR_PTR(err) : NULL;
>  out_req:
>  	if (!IS_ERR(ret) && req->r_dentry != dentry)
>  		/* Some other dentry was spliced in */

I think that this modification doesn't make sense. The ERR_PTR(0) returns NULL,
as far as I can understand.

  static inline void * __must_check ERR_PTR(long error)
  {
      return (void *) error;
  }

ERR_PTR(0) evaluates to (void *)0, which is exactly NULL.

Thanks,
Slava.

  reply	other threads:[~2026-05-20 18:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20  9:54 Hongling Zeng
2026-05-20 18:49 ` Viacheslav Dubeyko [this message]
2026-05-20 22:41   ` David Laight
2026-05-20 22:45     ` Viacheslav Dubeyko
2026-05-26 20:57       ` Viacheslav Dubeyko

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=d2cd070ded01305414815248032bbfc331c392ee.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=amarkuze@redhat.com \
    --cc=brauner@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=slava@dubeyko.com \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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

all inboxes | Powered by JetHome®