linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dai.ngo@oracle.com
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: chuck.lever@oracle.com, jlayton@redhat.com,
	viro@zeniv.linux.org.uk, linux-nfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC v22 1/7] NFSD: add courteous server support for thread with only delegation
Date: Wed, 27 Apr 2022 09:41:16 -0700	[thread overview]
Message-ID: <a06066fe-4fbf-0fcc-3ae8-107fd1c45183@oracle.com> (raw)
In-Reply-To: <20220427161221.GD13471@fieldses.org>


On 4/27/22 9:12 AM, J. Bruce Fields wrote:
> On Wed, Apr 27, 2022 at 01:52:47AM -0700, Dai Ngo wrote:
>> +	if (!try_to_expire_client(clp)) {
>> +		nn = net_generic(clp->net, nfsd_net_id);
>> +		mod_delayed_work(laundry_wq, &nn->laundromat_work, 0);
>> +	}
> ...
>> +static inline bool try_to_expire_client(struct nfs4_client *clp)
>> +{
>> +	bool ret;
>> +
>> +	ret = NFSD4_ACTIVE ==
>> +		cmpxchg(&clp->cl_state, NFSD4_COURTESY, NFSD4_EXPIRABLE);
>> +	return ret;
>> +}
> Hm, this feels a little backwards to me.

yes, I should have renamed the function to something like 'is_client_active()'.

>    I'd expect
> "try_to_expire_client" to return true on success.  Maybe call it
> "client_is_expirable()" to make that clear?  Or stick with
> "try_to_expire_client and make it return 0/-EAGAIN.
>
> If "NFSD4_ACTIVE != cmpxchg(...)" is too confusing, I don't think we
> really even need the atomic return of the previous value, I think it
> would be OK just to do:
>
> 	cmpschg(&clp->cl_state, NFSD4_COURTESY, NFSD4_EXPIRABLE);
> 	return clp->cl_state == NFSD4_EXPIRABLE;

I'll change to this:

static inline bool try_to_expire_client(struct nfs4_client *clp)
{
         bool ret;
	
	cmpxchg(&clp->cl_state, NFSD4_COURTESY, NFSD4_EXPIRABLE);
	return clp->cl_state == NFSD4_EXPIRABLE;

}

and its caller:

	if (try_to_expire_client(clp)) {
		nn = net_generic(clp->net, nfsd_net_id);
		mod_delayed_work(laundry_wq, &nn->laundromat_work, 0);
	}

-Dai

>
> --b.

  reply	other threads:[~2022-04-27 16:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  8:52 [PATCH RFC v22 0/7] NFSD: Initial implementation of NFSv4 Courteous Server Dai Ngo
2022-04-27  8:52 ` [PATCH RFC v22 1/7] NFSD: add courteous server support for thread with only delegation Dai Ngo
2022-04-27 16:12   ` J. Bruce Fields
2022-04-27 16:41     ` dai.ngo [this message]
2022-04-27 18:46   ` J. Bruce Fields
2022-04-27 18:53     ` dai.ngo
2022-04-27 19:09     ` dai.ngo
2022-04-27 19:13       ` J. Bruce Fields
2022-04-27 21:56   ` J. Bruce Fields
2022-04-27 22:52     ` dai.ngo
2022-04-28  1:52       ` J. Bruce Fields
2022-04-28  3:44         ` dai.ngo
2022-04-28  6:36           ` dai.ngo
2022-04-27  8:52 ` [PATCH RFC v22 2/7] NFSD: add support for share reservation conflict to courteous server Dai Ngo
2022-04-27  8:52 ` [PATCH RFC v22 3/7] NFSD: move create/destroy of laundry_wq to init_nfsd and exit_nfsd Dai Ngo
2022-04-27  8:52 ` [PATCH RFC v22 4/7] fs/lock: add helper locks_owner_has_blockers to check for blockers Dai Ngo
2022-04-27  8:52 ` [PATCH RFC v22 5/7] fs/lock: add 2 callbacks to lock_manager_operations to resolve conflict Dai Ngo
2022-04-27  8:52 ` [PATCH RFC v22 6/7] NFSD: add support for lock conflict to courteous server Dai Ngo
2022-04-27 18:50   ` dai.ngo
2022-04-28  2:05   ` J. Bruce Fields
2022-04-28  3:47     ` dai.ngo
2022-04-27  8:52 ` [PATCH RFC v22 7/7] NFSD: Show state of courtesy client in client info Dai Ngo

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=a06066fe-4fbf-0fcc-3ae8-107fd1c45183@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).