From: Christoph Hellwig <hch@lst.de>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
Oleg Nesterov <oleg@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
Davide Libenzi <davidel@xmailserver.org>,
David Miller <davem@davemloft.net>,
Christoph Hellwig <hch@lst.de>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Matt Mackall <mpm@selenic.com>
Subject: Re: [PATCH 2/4] Use f_lock to protect f_flags
Date: Sun, 8 Feb 2009 10:02:20 +0100 [thread overview]
Message-ID: <20090208090220.GB18521@lst.de> (raw)
In-Reply-To: <1234037217-16124-3-git-send-email-corbet@lwn.net>
On Sat, Feb 07, 2009 at 01:06:55PM -0700, Jonathan Corbet wrote:
> Traditionally, changes to struct file->f_flags have been done under BKL
> protection, or with no protection at all. This patch causes all f_flags
> changes after file open/creation time to be done under protection of
> f_lock. This allows the removal of some BKL usage and fixes a number of
> longstanding (if microscopic) races.
Looks good to me.
Reviewed-by: Christoph Hellwig <hch@lst.de>
One comments only tangentially related to the patch:
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index bc84e12..224f271 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -2162,13 +2162,12 @@ static int fionbio(struct file *file, int __user *p)
> if (get_user(nonblock, p))
> return -EFAULT;
>
> - /* file->f_flags is still BKL protected in the fs layer - vomit */
> - lock_kernel();
> + spin_lock(&file->f_lock);
> if (nonblock)
> file->f_flags |= O_NONBLOCK;
> else
> file->f_flags &= ~O_NONBLOCK;
> - unlock_kernel();
> + spin_unlock(&file->f_lock);
> return 0;
> }
Why is this code there at all? It's a duplicate of
fs/ioctl.c:ioctl_fionbio minus the sparc special case, and from looking
at the flow in fs/ioctl.c I'm pretty sure FIONBIO never gets handed to
the chardev ioctl methods..
next prev parent reply other threads:[~2009-02-08 9:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 20:06 [PATCH/RFC] Fasync BKL removal Jonathan Corbet
2009-02-07 20:06 ` [PATCH 1/4] Rename struct file->f_ep_lock Jonathan Corbet
2009-02-08 8:56 ` Christoph Hellwig
2009-02-08 19:51 ` Davide Libenzi
2009-02-07 20:06 ` [PATCH 2/4] Use f_lock to protect f_flags Jonathan Corbet
2009-02-08 9:02 ` Christoph Hellwig [this message]
2009-02-07 20:06 ` [PATCH 3/4] Move FASYNC bit handling to f_op->fasync() Jonathan Corbet
2009-02-08 9:05 ` Christoph Hellwig
2009-02-10 2:41 ` Jonathan Corbet
2009-02-07 20:06 ` [PATCH 4/4] Rationalize fasync return values Jonathan Corbet
2009-02-07 20:28 ` [PATCH/RFC] Fasync BKL removal Matt Mackall
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=20090208090220.GB18521@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andi@firstfloor.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=oleg@redhat.com \
--cc=viro@ZenIV.linux.org.uk \
/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.