1

io_uring-6.12-20241101

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmclGPIQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpkQeEADAev0zXiTqSAJ57WDEFuwYaZWZi0S/ru5W
 LUMczT0FKl5uB5Ik/T7N+n/CU8ODHuV3Ch7LaVv9mO2V8bio+/IZzKJrmlZqkz+c
 MTdl/w84TkKlV04wcri8rF2nhwFh8LWJfLqpU8Fdh9K9dwyr/rj6ZDTJBYXX4fCW
 PE3DG7YHHG9EAO7lx51RF41E9fLj69F40XVQIa6Tnf0GheE0SrjMcjw5I3eCrM7g
 KxlynICG47BuJ0l5qlX5xXbaiJzNBFm3SLJVswnpjgUq7atKba1L4hfdqowqv4oz
 N6Bzln22UP1oDmHaSuczc5XpGQQdd5DIoLtIvP2bCZxR5F7wOL87s5v/j1bVDbw8
 1omDhM9kHdlQMbQA3u5wSdSxnc+YFj/47bcwcBar3VQyHaATY1y9AaUF+8pBmpUn
 ckZhOepFbjayMuz3pK8qKtICzudC3W3fig3mgyPBBK34vV3wmnGEo8Ik1lz+JC9v
 B9jwzuXtYmpRbVDb7dQB6xknrW1dIlvvqvn30a8CUMZdYfCDUeAb7P2xArJupygf
 IVvX1ae1s3Vo16gfXirurrYXxuRf+tutLXg1++gx0+a+iTGwrjqkG7rE38A0hdL5
 OppxDhyD2FTTb4/j/hzOKJixIEFfbusIdVEJF9RN9aLOpLhY0OoaCNr8Dk5977X9
 TUbv9GxD/Q==
 =3tUs
 -----END PGP SIGNATURE-----

Merge tag 'io_uring-6.12-20241101' of git://git.kernel.dk/linux

Pull io_uring fix from Jens Axboe:

 - Fix not honoring IOCB_NOWAIT for starting buffered writes in terms of
   calling sb_start_write(), leading to a deadlock if someone is
   attempting to freeze the file system with writes in progress, as each
   side will end up waiting for the other to make progress.

* tag 'io_uring-6.12-20241101' of git://git.kernel.dk/linux:
  io_uring/rw: fix missing NOWAIT check for O_DIRECT start write
This commit is contained in:
Linus Torvalds 2024-11-01 13:38:01 -10:00
commit f0d3699aef

View File

@ -1014,6 +1014,25 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
return IOU_OK;
}
static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb)
{
struct inode *inode;
bool ret;
if (!(req->flags & REQ_F_ISREG))
return true;
if (!(kiocb->ki_flags & IOCB_NOWAIT)) {
kiocb_start_write(kiocb);
return true;
}
inode = file_inode(kiocb->ki_filp);
ret = sb_start_write_trylock(inode->i_sb);
if (ret)
__sb_writers_release(inode->i_sb, SB_FREEZE_WRITE);
return ret;
}
int io_write(struct io_kiocb *req, unsigned int issue_flags)
{
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
@ -1051,8 +1070,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
if (unlikely(ret))
return ret;
if (req->flags & REQ_F_ISREG)
kiocb_start_write(kiocb);
if (unlikely(!io_kiocb_start_write(req, kiocb)))
return -EAGAIN;
kiocb->ki_flags |= IOCB_WRITE;
if (likely(req->file->f_op->write_iter))