All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Nicolai Stange <nstange@suse.de>
Subject: Backport of commit "io_uring: grab ->fs as part of async preparation"
Date: Mon, 11 Jan 2021 11:27:04 +0100	[thread overview]
Message-ID: <20210111102704.GA808@quack2.suse.cz> (raw)

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

                 reply	other threads:[~2021-01-11 10:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210111102704.GA808@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=nstange@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.