Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1325805 > unrolled thread
| Started by | William Dauchy <wdauchy@gmail.com> |
|---|---|
| First post | 2016-02-03 19:30 +0100 |
| Last post | 2016-02-03 19:30 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: fs: WARNING in locks_free_lock_context() William Dauchy <wdauchy@gmail.com> - 2016-02-03 19:30 +0100
Re: fs: WARNING in locks_free_lock_context() Jeff Layton <jlayton@poochiereds.net> - 2016-02-03 19:30 +0100
Re: fs: WARNING in locks_free_lock_context() William Dauchy <wdauchy@gmail.com> - 2016-02-03 19:30 +0100
| From | William Dauchy <wdauchy@gmail.com> |
|---|---|
| Date | 2016-02-03 19:30 +0100 |
| Subject | Re: fs: WARNING in locks_free_lock_context() |
| Message-ID | <qYalI-5xv-9@gated-at.bofh.it> |
Hello Jeff,
On Wed, Dec 23, 2015 at 2:54 PM, Jeff Layton <jlayton@poochiereds.net> wrote:
> Ooh, nice catch...and just in time for Christmas.
>
> filp_close does this after the fd has been detached from the file table
> in __close_fd:
>
> if (likely(!(filp->f_mode & FMODE_PATH))) {
> dnotify_flush(filp, id);
> locks_remove_posix(filp, id);
> }
> fput(filp);
>
> ...and fcntl_setlk does this:
>
> /*
> * Attempt to detect a close/fcntl race and recover by
> * releasing the lock that was just acquired.
> */
> /*
> * we need that spin_lock here - it prevents reordering between
> * update of i_flctx->flc_posix and check for it done in close().
> * rcu_read_lock() wouldn't do.
> */
> spin_lock(¤t->files->file_lock);
> f = fcheck(fd);
> spin_unlock(¤t->files->file_lock);
> if (!error && f != filp && flock.l_type != F_UNLCK) {
> flock.l_type = F_UNLCK;
> goto again;
> }
>
> ...so in principle that should keep new locks from racing onto the list
> just after we call filp_close. Hmm...I'll see if I can reproduce and
> figure out how this could happen.
Just wondering if you had the time to figure out this warning?
Thanks,
--
William
[toc] | [next] | [standalone]
| From | Jeff Layton <jlayton@poochiereds.net> |
|---|---|
| Date | 2016-02-03 19:30 +0100 |
| Message-ID | <qYalI-5xv-13@gated-at.bofh.it> |
| In reply to | #1325805 |
On Wed, 3 Feb 2016 19:19:37 +0100
William Dauchy <wdauchy@gmail.com> wrote:
> Hello Jeff,
>
> On Wed, Dec 23, 2015 at 2:54 PM, Jeff Layton <jlayton@poochiereds.net> wrote:
> > Ooh, nice catch...and just in time for Christmas.
> >
> > filp_close does this after the fd has been detached from the file table
> > in __close_fd:
> >
> > if (likely(!(filp->f_mode & FMODE_PATH))) {
> > dnotify_flush(filp, id);
> > locks_remove_posix(filp, id);
> > }
> > fput(filp);
> >
> > ...and fcntl_setlk does this:
> >
> > /*
> > * Attempt to detect a close/fcntl race and recover by
> > * releasing the lock that was just acquired.
> > */
> > /*
> > * we need that spin_lock here - it prevents reordering between
> > * update of i_flctx->flc_posix and check for it done in close().
> > * rcu_read_lock() wouldn't do.
> > */
> > spin_lock(¤t->files->file_lock);
> > f = fcheck(fd);
> > spin_unlock(¤t->files->file_lock);
> > if (!error && f != filp && flock.l_type != F_UNLCK) {
> > flock.l_type = F_UNLCK;
> > goto again;
> > }
> >
> > ...so in principle that should keep new locks from racing onto the list
> > just after we call filp_close. Hmm...I'll see if I can reproduce and
> > figure out how this could happen.
>
> Just wondering if you had the time to figure out this warning?
>
> Thanks,
Yes...this commit in mainline fixes it:
commit 7f3697e24dc3820b10f445a4a7d914fc356012d1
Author: Jeff Layton <jeff.layton@primarydata.com>
Date: Thu Jan 7 16:38:10 2016 -0500
locks: fix unlock when fcntl_setlk races with a close
...and the patch is applicable to all kernels currently in circulation.
The original bug is very old (from 2005).
--
Jeff Layton <jlayton@poochiereds.net>
[toc] | [prev] | [next] | [standalone]
| From | William Dauchy <wdauchy@gmail.com> |
|---|---|
| Date | 2016-02-03 19:30 +0100 |
| Message-ID | <qYalI-5xv-19@gated-at.bofh.it> |
| In reply to | #1325807 |
On Wed, Feb 3, 2016 at 7:26 PM, Jeff Layton <jlayton@poochiereds.net> wrote: > Yes...this commit in mainline fixes it: Thanks Jeff, I missed it. -- William
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web