mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
aio: avoid pointless cred reference count bump
iocb->fsync.creds already holds a reference count that is stable while the operation is performed. Link: https://lore.kernel.org/r/20241125-work-cred-v2-10-68b9d38bb5b2@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
7c0c3b346a
commit
b37eab47cf
4
fs/aio.c
4
fs/aio.c
@ -1639,10 +1639,10 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
|
|||||||
static void aio_fsync_work(struct work_struct *work)
|
static void aio_fsync_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work);
|
struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work);
|
||||||
const struct cred *old_cred = override_creds(get_new_cred(iocb->fsync.creds));
|
const struct cred *old_cred = override_creds(iocb->fsync.creds);
|
||||||
|
|
||||||
iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
|
iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
|
||||||
put_cred(revert_creds(old_cred));
|
revert_creds(old_cred);
|
||||||
put_cred(iocb->fsync.creds);
|
put_cred(iocb->fsync.creds);
|
||||||
iocb_put(iocb);
|
iocb_put(iocb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user