nfsd: make nfsd4_run_cb a bool return function
[ Upstream commit b95239ca49
]
queue_work can return false and not queue anything, if the work is
already queued. If that happens in the case of a CB_RECALL, we'll have
taken an extra reference to the stid that will never be put. Ensure we
throw a warning in that case.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Родитель
f6279fa0dc
Коммит
e55378bce5
|
@ -1373,11 +1373,21 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
|
|||
cb->cb_holds_slot = false;
|
||||
}
|
||||
|
||||
void nfsd4_run_cb(struct nfsd4_callback *cb)
|
||||
/**
|
||||
* nfsd4_run_cb - queue up a callback job to run
|
||||
* @cb: callback to queue
|
||||
*
|
||||
* Kick off a callback to do its thing. Returns false if it was already
|
||||
* on a queue, true otherwise.
|
||||
*/
|
||||
bool nfsd4_run_cb(struct nfsd4_callback *cb)
|
||||
{
|
||||
struct nfs4_client *clp = cb->cb_clp;
|
||||
bool queued;
|
||||
|
||||
nfsd41_cb_inflight_begin(clp);
|
||||
if (!nfsd4_queue_cb(cb))
|
||||
queued = nfsd4_queue_cb(cb);
|
||||
if (!queued)
|
||||
nfsd41_cb_inflight_end(clp);
|
||||
return queued;
|
||||
}
|
||||
|
|
|
@ -4874,14 +4874,13 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
|
|||
* we know it's safe to take a reference.
|
||||
*/
|
||||
refcount_inc(&dp->dl_stid.sc_count);
|
||||
nfsd4_run_cb(&dp->dl_recall);
|
||||
WARN_ON_ONCE(!nfsd4_run_cb(&dp->dl_recall));
|
||||
}
|
||||
|
||||
/* Called from break_lease() with flc_lock held. */
|
||||
static bool
|
||||
nfsd_break_deleg_cb(struct file_lock *fl)
|
||||
{
|
||||
bool ret = false;
|
||||
struct nfs4_delegation *dp = (struct nfs4_delegation *)fl->fl_owner;
|
||||
struct nfs4_file *fp = dp->dl_stid.sc_file;
|
||||
struct nfs4_client *clp = dp->dl_stid.sc_client;
|
||||
|
@ -4907,7 +4906,7 @@ nfsd_break_deleg_cb(struct file_lock *fl)
|
|||
fp->fi_had_conflict = true;
|
||||
nfsd_break_one_deleg(dp);
|
||||
spin_unlock(&fp->fi_lock);
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -692,7 +692,7 @@ extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
|
|||
extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
|
||||
extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
|
||||
const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op);
|
||||
extern void nfsd4_run_cb(struct nfsd4_callback *cb);
|
||||
extern bool nfsd4_run_cb(struct nfsd4_callback *cb);
|
||||
extern int nfsd4_create_callback_queue(void);
|
||||
extern void nfsd4_destroy_callback_queue(void);
|
||||
extern void nfsd4_shutdown_callback(struct nfs4_client *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче