Backport of commit "io_uring: grab ->fs as part of async preparation"

From: Jan Kara <jack@suse.cz>
Date: 2021-01-11 10:28:02

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 [off-list ref]
SUSE Labs, CR
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help