linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Backport of commit "io_uring: grab ->fs as part of async preparation"
@ 2021-01-11 10:27 Jan Kara
  0 siblings, 0 replies; only message in thread
From: Jan Kara @ 2021-01-11 10:27 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Nicolai Stange

Hi Jens,

I have a question regarding your backport of the commit ff002b30181d
"io_uring: grab ->fs as part of async offload" to 5.4-stable tree. Nicolai
has noticed that the handling of 'old_fs_struct' variable in
io_sq_wq_submit_work() looks fishy. The code looks like:

old_fs_struct = current->fs;

do {
...
	if (req->fs != current->fs && current->fs != old_fs_struct) {
		task_lock(current);
		if (req->fs)
			current->fs = req->fs;
		else
			current->fs = old_fs_struct;
		task_unlock(current);
	}
	...
} while (req);

And the problem with this is that the condition can never be true because
current->fs will never become different from old_fs_struct. I think the
condition should be just 'req->fs != current->fs' - we then either set the
new req->fs, or revert to the original old_fs_struct... What do you think?

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-11 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-11 10:27 Backport of commit "io_uring: grab ->fs as part of async preparation" Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).