Message ID | 20250301183151.11362-2-cel@kernel.org (mailing list archive) |
---|---|
State | Under Review |
Delegated to: | Chuck Lever |
Headers | show |
Series | Implement referring call lists for CB_OFFLOAD | expand |
On Sat, 2025-03-01 at 13:31 -0500, cel@kernel.org wrote: > From: Chuck Lever <chuck.lever@oracle.com> > > Update the status of an async COPY operation when it has been > stopped. OFFLOAD_STATUS needs to indicate that the COPY is no longer > running. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > fs/nfsd/nfs4proc.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > index f6e06c779d09..9a0e68aa246f 100644 > --- a/fs/nfsd/nfs4proc.c > +++ b/fs/nfsd/nfs4proc.c > @@ -1379,8 +1379,11 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) > static void nfsd4_stop_copy(struct nfsd4_copy *copy) > { > trace_nfsd_copy_async_cancel(copy); > - if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) > + if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) { > kthread_stop(copy->copy_task); > + copy->nfserr = nfs_ok; > + set_bit(NFSD4_COPY_F_COMPLETED, ©->cp_flags); > + } > nfs4_put_copy(copy); > } > STOPPED and COMPLETED seem to basically track each other. What's the distinction between the two bits? When is one set, but not the other?
On 3/2/25 4:35 PM, Jeff Layton wrote: > On Sat, 2025-03-01 at 13:31 -0500, cel@kernel.org wrote: >> From: Chuck Lever <chuck.lever@oracle.com> >> >> Update the status of an async COPY operation when it has been >> stopped. OFFLOAD_STATUS needs to indicate that the COPY is no longer >> running. >> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> fs/nfsd/nfs4proc.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c >> index f6e06c779d09..9a0e68aa246f 100644 >> --- a/fs/nfsd/nfs4proc.c >> +++ b/fs/nfsd/nfs4proc.c >> @@ -1379,8 +1379,11 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) >> static void nfsd4_stop_copy(struct nfsd4_copy *copy) >> { >> trace_nfsd_copy_async_cancel(copy); >> - if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) >> + if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) { >> kthread_stop(copy->copy_task); >> + copy->nfserr = nfs_ok; >> + set_bit(NFSD4_COPY_F_COMPLETED, ©->cp_flags); >> + } >> nfs4_put_copy(copy); >> } >> > > STOPPED and COMPLETED seem to basically track each other. What's the > distinction between the two bits? When is one set, but not the other? IIRC: COMPLETED means the background COPY is no longer running. It prevents kthread_stop() from being called more than once on the same kthread. STOPPED means that the background COPY is no longer running because something stopped it before it could finish normally -- more or less this is like being signaled. We could name it "ABEND" or something else.
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index f6e06c779d09..9a0e68aa246f 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1379,8 +1379,11 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) static void nfsd4_stop_copy(struct nfsd4_copy *copy) { trace_nfsd_copy_async_cancel(copy); - if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) + if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) { kthread_stop(copy->copy_task); + copy->nfserr = nfs_ok; + set_bit(NFSD4_COPY_F_COMPLETED, ©->cp_flags); + } nfs4_put_copy(copy); }