Re: [PATCH] fs: Fix jfs_fsync() Sleeping in Invalid Context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 25, 2025 at 11:03:36PM +0530, Purva Yeshi wrote:
> +++ b/fs/direct-io.c
> @@ -356,13 +356,9 @@ static void dio_bio_end_aio(struct bio *bio)
>  			defer_completion = dio->defer_completion ||
>  					   (dio_op == REQ_OP_WRITE &&
>  					    dio->inode->i_mapping->nrpages);
> -		if (defer_completion) {
> -			INIT_WORK(&dio->complete_work, dio_aio_complete_work);
> -			queue_work(dio->inode->i_sb->s_dio_done_wq,
> -				   &dio->complete_work);
> -		} else {
> -			dio_complete(dio, 0, DIO_COMPLETE_ASYNC);
> -		}
> +
> +		INIT_WORK(&dio->complete_work, dio_aio_complete_work);
> +		queue_work(dio->inode->i_sb->s_dio_done_wq, &dio->complete_work);

This patch is definitely wrong.  If it were the right thing to do, then
since defer_completion is now un-read, we should stop calculating it.

I'm not sure what the right solution is; should we simply do:

                        defer_completion = dio->defer_completion ||
+					   in_atomic() ||
                                           (dio_op == REQ_OP_WRITE &&
                                            dio->inode->i_mapping->nrpages);

I'm kind of surprised this problem hasn't cropped up before now ...




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux