From: Xiubo Li <xiubli@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: jlayton@kernel.org, viro@zeniv.linux.org.uk, idryomov@gmail.com,
vshankar@redhat.com, ceph-devel@vger.kernel.org,
dchinner@redhat.com, hch@lst.de, arnd@arndb.de,
mcgrof@kernel.org, akpm@linux-foundation.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v3 2/2] ceph: wait the first reply of inflight async unlink
Date: Wed, 18 May 2022 09:03:00 +0800 [thread overview]
Message-ID: <acf2457a-a984-d490-2833-be7cfd25c729@redhat.com> (raw)
In-Reply-To: <YoOy40sGQv4DjmAq@casper.infradead.org>
On 5/17/22 10:36 PM, Matthew Wilcox wrote:
> On Tue, May 17, 2022 at 08:55:49PM +0800, Xiubo Li wrote:
>> +int ceph_wait_on_conflict_unlink(struct dentry *dentry)
>> +{
>> + struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
>> + struct dentry *pdentry = dentry->d_parent;
>> + struct dentry *udentry, *found = NULL;
>> + struct ceph_dentry_info *di;
>> + struct qstr dname;
>> + u32 hash = dentry->d_name.hash;
>> + int err;
>> +
>> + dname.name = dentry->d_name.name;
>> + dname.len = dentry->d_name.len;
>> +
>> + rcu_read_lock();
>> + hash_for_each_possible_rcu(fsc->async_unlink_conflict, di,
>> + hnode, hash) {
>> + udentry = di->dentry;
>> +
>> + spin_lock(&udentry->d_lock);
>> + if (udentry->d_name.hash != hash)
>> + goto next;
>> + if (unlikely(udentry->d_parent != pdentry))
>> + goto next;
>> + if (!hash_hashed(&di->hnode))
>> + goto next;
>> +
>> + if (!test_bit(CEPH_DENTRY_ASYNC_UNLINK_BIT, &di->flags))
>> + pr_warn("%s dentry %p:%pd async unlink bit is not set\n",
>> + __func__, dentry, dentry);
>> +
>> + if (d_compare(pdentry, udentry, &dname))
>> + goto next;
>> +
>> + spin_unlock(&udentry->d_lock);
>> + found = dget(udentry);
>> + break;
>> +next:
>> + spin_unlock(&udentry->d_lock);
>> + }
>> + rcu_read_unlock();
>> +
>> + if (likely(!found))
>> + return 0;
>> +
>> + dout("%s dentry %p:%pd conflict with old %p:%pd\n", __func__,
>> + dentry, dentry, found, found);
>> +
>> + err = wait_on_bit(&di->flags, CEPH_DENTRY_ASYNC_UNLINK_BIT,
>> + TASK_INTERRUPTIBLE);
> Do you really want to use TASK_INTERRUPTIBLE here? If the window is
> resized and you get a SIGWINCH, or a timer goes off and you get a
> SIGALRM, you want to return -EINTR? I would suggest that TASK_KILLABLE
> is probably the semantics that you want.
>
Sounds reasonable. I will switch to use the TASK_KILLABLE.
@Jeff
I just copied this code from ceph_wait_on_async_create(). BTW, do we
have any other consideration that we must use the TASK_INTERRUPTIBLE there ?
Thanks.
-- Xiubo
prev parent reply other threads:[~2022-05-18 1:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 12:55 [PATCH v3 0/2] ceph: wait async unlink to finish Xiubo Li
2022-05-17 12:55 ` [PATCH v3 1/2] fs/dcache: add d_compare() helper support Xiubo Li
2022-05-17 12:55 ` [PATCH v3 2/2] ceph: wait the first reply of inflight async unlink Xiubo Li
2022-05-17 14:36 ` Matthew Wilcox
2022-05-18 1:03 ` Xiubo Li [this message]
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=acf2457a-a984-d490-2833-be7cfd25c729@redhat.com \
--to=xiubli@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=ceph-devel@vger.kernel.org \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mcgrof@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=vshankar@redhat.com \
--cc=willy@infradead.org \
/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®