From: Al Viro <viro@zeniv.linux.org.uk>
To: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Cc: "slava@dubeyko.com" <slava@dubeyko.com>,
Alex Markuze <amarkuze@redhat.com>,
"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
"idryomov@gmail.com" <idryomov@gmail.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
Patrick Donnelly <pdonnell@redhat.com>
Subject: Re: [PATCH] ceph: is_root_ceph_dentry() cleanup
Date: Wed, 29 Jan 2025 01:12:18 +0000 [thread overview]
Message-ID: <20250129011218.GP1977892@ZenIV> (raw)
In-Reply-To: <dfafe82535b7931e99790a956d5009a960dc9e0d.camel@ibm.com>
On Tue, Jan 28, 2025 at 11:27:05PM +0000, Viacheslav Dubeyko wrote:
> I assume that you imply this code:
>
> /* can we conclude ENOENT locally? */
> if (d_really_is_negative(dentry)) {
> struct ceph_inode_info *ci = ceph_inode(dir);
> struct ceph_dentry_info *di = ceph_dentry(dentry);
>
> spin_lock(&ci->i_ceph_lock);
> doutc(cl, " dir %llx.%llx flags are 0x%lx\n",
> ceph_vinop(dir), ci->i_ceph_flags);
> if (strncmp(dentry->d_name.name,
> fsc->mount_options->snapdir_name,
> dentry->d_name.len) &&
> !is_root_ceph_dentry(dir, dentry) &&
> ceph_test_mount_opt(fsc, DCACHE) &&
> __ceph_dir_is_complete(ci) &&
> __ceph_caps_issued_mask_metric(ci, CEPH_CAP_FILE_SHARED,
> 1)) {
> __ceph_touch_fmode(ci, mdsc, CEPH_FILE_MODE_RD);
> spin_unlock(&ci->i_ceph_lock);
> doutc(cl, " dir %llx.%llx complete, -ENOENT\n",
> ceph_vinop(dir));
> d_add(dentry, NULL);
> di->lease_shared_gen = atomic_read(&ci->i_shared_gen);
> return NULL;
> }
> spin_unlock(&ci->i_ceph_lock);
> }
>
> Am I correct? So, how can we rework this code if it's wrong? What is your
> vision? Do you mean that it's dead code? How can we check it?
I mean that ->lookup() is called *ONLY* for a negative unhashed dentries.
In other words, on a call from VFS that condition will always be true.
That part is easily provable; what is harder to reason about is the
direct call of ceph_lookup() from ceph_handle_notrace_create().
The callers of that thing (ceph_mknod(), ceph_symlink() and ceph_mkdir())
are all guaranteed that dentry will be negative when they are called.
The hard-to-reason-about part is the call of ceph_mdsc_do_request()
directly preceding the calls of ceph_handle_notrace_create().
Can ceph_mdsc_do_request() return 0, with req->r_reply_info.head->is_dentry
being false *AND* a call of splice_dentry() made by ceph_fill_trace() called
by ceph_mdsc_do_request()?
AFAICS, there are 3 calls of splice_dentry(); two of them happen under
explicit check for ->is_dentry and thus are not interesting for our
purposes. The third one, though, could be hit with ->is_dentry being
false and ->r_op being CEPH_MDS_OP_MKSNAP. That is not impossible
from ceph_mkdir(), as far as I can tell, and I don't understand the
details well enough to tell whether it can actually happen.
Is it actually possible to hit ceph_handle_notrace_create() with
a positive dentry?
next prev parent reply other threads:[~2025-01-29 1:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 1:10 [PATCH] ceph: is_root_ceph_dentry() cleanup Viacheslav Dubeyko
2025-01-28 3:07 ` Al Viro
2025-01-28 23:27 ` Viacheslav Dubeyko
2025-01-29 1:12 ` Al Viro [this message]
2025-02-11 0:08 ` Viacheslav Dubeyko
2025-02-11 0:15 ` Al Viro
2025-02-11 18:01 ` Viacheslav Dubeyko
2025-02-11 19:01 ` Al Viro
2025-02-11 19:32 ` Viacheslav Dubeyko
2025-02-11 21:40 ` Al Viro
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=20250129011218.GP1977892@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=Slava.Dubeyko@ibm.com \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=pdonnell@redhat.com \
--cc=slava@dubeyko.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).