mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
nfs/localio: restore creds before releasing pageio data
Otherwise if the nfsd filecache code releases the nfsd_file
immediately, it can trigger the BUG_ON(cred == current->cred) in
__put_cred() when it puts the nfsd_file->nf_file->f-cred.
Fixes: b9f5dd57f4 ("nfs/localio: use dedicated workqueues for filesystem read and write")
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Link: https://lore.kernel.org/r/20250807164938.2395136-1-smayhew@redhat.com
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
committed by
Trond Myklebust
parent
4fb2b677fc
commit
992203a1fb
@@ -453,12 +453,13 @@ static void nfs_local_call_read(struct work_struct *work)
|
|||||||
nfs_local_iter_init(&iter, iocb, READ);
|
nfs_local_iter_init(&iter, iocb, READ);
|
||||||
|
|
||||||
status = filp->f_op->read_iter(&iocb->kiocb, &iter);
|
status = filp->f_op->read_iter(&iocb->kiocb, &iter);
|
||||||
|
|
||||||
|
revert_creds(save_cred);
|
||||||
|
|
||||||
if (status != -EIOCBQUEUED) {
|
if (status != -EIOCBQUEUED) {
|
||||||
nfs_local_read_done(iocb, status);
|
nfs_local_read_done(iocb, status);
|
||||||
nfs_local_pgio_release(iocb);
|
nfs_local_pgio_release(iocb);
|
||||||
}
|
}
|
||||||
|
|
||||||
revert_creds(save_cred);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -648,14 +649,15 @@ static void nfs_local_call_write(struct work_struct *work)
|
|||||||
file_start_write(filp);
|
file_start_write(filp);
|
||||||
status = filp->f_op->write_iter(&iocb->kiocb, &iter);
|
status = filp->f_op->write_iter(&iocb->kiocb, &iter);
|
||||||
file_end_write(filp);
|
file_end_write(filp);
|
||||||
|
|
||||||
|
revert_creds(save_cred);
|
||||||
|
current->flags = old_flags;
|
||||||
|
|
||||||
if (status != -EIOCBQUEUED) {
|
if (status != -EIOCBQUEUED) {
|
||||||
nfs_local_write_done(iocb, status);
|
nfs_local_write_done(iocb, status);
|
||||||
nfs_local_vfs_getattr(iocb);
|
nfs_local_vfs_getattr(iocb);
|
||||||
nfs_local_pgio_release(iocb);
|
nfs_local_pgio_release(iocb);
|
||||||
}
|
}
|
||||||
|
|
||||||
revert_creds(save_cred);
|
|
||||||
current->flags = old_flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user