mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
nfsd: make nfsd4_callback_ops->prepare operation bool return
For a CB_NOTIFY operation, we need to stop processing the callback if an allocation fails. Change the ->prepare callback operation to return true if processing should continue, and false otherwise. Signed-off-by: Jeff Layton <jlayton@kernel.org> Acked-by: Chuck Lever <chuck.lever@oracle.com> Link: https://patch.msgid.link/20260616-dir-deleg-v7-6-6cbc7eac0ade@kernel.org Signed-off-by: Chuck Lever <cel@kernel.org>
This commit is contained in:
parent
56240e6fe6
commit
ee2752a884
|
|
@ -1790,7 +1790,10 @@ nfsd4_run_cb_work(struct work_struct *work)
|
|||
|
||||
if (!test_and_clear_bit(NFSD4_CALLBACK_REQUEUE, &cb->cb_flags)) {
|
||||
if (cb->cb_ops && cb->cb_ops->prepare)
|
||||
cb->cb_ops->prepare(cb);
|
||||
if (!cb->cb_ops->prepare(cb)) {
|
||||
nfsd41_destroy_cb(cb);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cb->cb_msg.rpc_cred = clp->cl_cb_cred;
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls, struct nfsd_file *file)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
nfsd4_cb_layout_prepare(struct nfsd4_callback *cb)
|
||||
{
|
||||
struct nfs4_layout_stateid *ls =
|
||||
|
|
@ -668,6 +668,7 @@ nfsd4_cb_layout_prepare(struct nfsd4_callback *cb)
|
|||
mutex_lock(&ls->ls_mutex);
|
||||
nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid);
|
||||
mutex_unlock(&ls->ls_mutex);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -357,12 +357,13 @@ remove_blocked_locks(struct nfs4_lockowner *lo)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb)
|
||||
{
|
||||
struct nfsd4_blocked_lock *nbl = container_of(cb,
|
||||
struct nfsd4_blocked_lock, nbl_cb);
|
||||
locks_delete_block(&nbl->nbl_lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -5613,7 +5614,7 @@ bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp, struct inode *inode)
|
|||
return timeo > 0;
|
||||
}
|
||||
|
||||
static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
|
||||
static bool nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
|
||||
{
|
||||
struct nfs4_delegation *dp = cb_to_delegation(cb);
|
||||
struct nfsd_net *nn = net_generic(dp->dl_stid.sc_client->net,
|
||||
|
|
@ -5634,6 +5635,7 @@ static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
|
|||
list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
|
||||
}
|
||||
spin_unlock(&nn->deleg_lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ struct nfsd4_callback {
|
|||
};
|
||||
|
||||
struct nfsd4_callback_ops {
|
||||
void (*prepare)(struct nfsd4_callback *);
|
||||
int (*done)(struct nfsd4_callback *, struct rpc_task *);
|
||||
void (*release)(struct nfsd4_callback *);
|
||||
bool (*prepare)(struct nfsd4_callback *cb);
|
||||
int (*done)(struct nfsd4_callback *cb, struct rpc_task *task);
|
||||
void (*release)(struct nfsd4_callback *cb);
|
||||
uint32_t opcode;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user