<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/fs/locks.c, branch stable/4.3.y</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F4.3.y</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F4.3.y'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-08-31T20:27:25Z</updated>
<entry>
<title>fs: fix fs/locks.c kernel-doc warning</title>
<updated>2015-08-31T20:27:25Z</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2015-08-10T01:43:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7fadc59cc89f207ff6ca3d0951e11265fb4f806e'/>
<id>urn:sha1:7fadc59cc89f207ff6ca3d0951e11265fb4f806e</id>
<content type='text'>
Fix kernel-doc warnings in fs/locks.c:

Warning(..//fs/locks.c:1577): No description found for parameter 'flags'

Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: inline posix_lock_file_wait and flock_lock_file_wait</title>
<updated>2015-07-13T10:29:11Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-07-11T10:43:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ee296d7c5709440f8abd36b5b65c6b3e388538d9'/>
<id>urn:sha1:ee296d7c5709440f8abd36b5b65c6b3e388538d9</id>
<content type='text'>
They just call file_inode and then the corresponding *_inode_file_wait
function. Just make them static inlines instead.

Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: new helpers - flock_lock_inode_wait and posix_lock_inode_wait</title>
<updated>2015-07-13T10:29:11Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-07-11T10:43:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=29d01b22eaa18d8b46091d3c98c6001c49f78e4a'/>
<id>urn:sha1:29d01b22eaa18d8b46091d3c98c6001c49f78e4a</id>
<content type='text'>
Allow callers to pass in an inode instead of a filp.

Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
Reviewed-by: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
Tested-by: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
</content>
</entry>
<entry>
<title>locks: have flock_lock_file take an inode pointer instead of a filp</title>
<updated>2015-07-13T10:29:11Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-07-11T10:43:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bcd7f78d078ff6197715c1ed070c92aca57ec12c'/>
<id>urn:sha1:bcd7f78d078ff6197715c1ed070c92aca57ec12c</id>
<content type='text'>
...and rename it to better describe how it works.

In order to fix a use-after-free in NFS, we need to be able to remove
locks from an inode after the filp associated with them may have already
been freed. flock_lock_file already only dereferences the filp to get to
the inode, so just change it so the callers do that.

All of the callers already pass in a lock request that has the fl_file
set properly, so we don't need to pass it in individually. With that
change it now only dereferences the filp to get to the inode, so just
push that out to the callers.

Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
Reviewed-by: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
Tested-by: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
</content>
</entry>
<entry>
<title>proc: show locks in /proc/pid/fdinfo/X</title>
<updated>2015-04-17T13:04:12Z</updated>
<author>
<name>Andrey Vagin</name>
<email>avagin@openvz.org</email>
</author>
<published>2015-04-16T19:49:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6c8c90319c0bb1c9e0b68e721359b89ae4f28465'/>
<id>urn:sha1:6c8c90319c0bb1c9e0b68e721359b89ae4f28465</id>
<content type='text'>
Let's show locks which are associated with a file descriptor in
its fdinfo file.

Currently we don't have a reliable way to determine who holds a lock.  We
can find some information in /proc/locks, but PID which is reported there
can be wrong.  For example, a process takes a lock, then forks a child and
dies.  In this case /proc/locks contains the parent pid, which can be
reused by another process.

$ cat /proc/locks
...
6: FLOCK  ADVISORY  WRITE 324 00:13:13431 0 EOF
...

$ ps -C rpcbind
  PID TTY          TIME CMD
  332 ?        00:00:00 rpcbind

$ cat /proc/332/fdinfo/4
pos:	0
flags:	0100000
mnt_id:	22
lock:	1: FLOCK  ADVISORY  WRITE 324 00:13:13431 0 EOF

$ ls -l /proc/332/fd/4
lr-x------ 1 root root 64 Mar  5 14:43 /proc/332/fd/4 -&gt; /run/rpcbind.lock

$ ls -l /proc/324/fd/
total 0
lrwx------ 1 root root 64 Feb 27 14:50 0 -&gt; /dev/pts/0
lrwx------ 1 root root 64 Feb 27 14:50 1 -&gt; /dev/pts/0
lrwx------ 1 root root 64 Feb 27 14:49 2 -&gt; /dev/pts/0

You can see that the process with the 324 pid doesn't hold the lock.

This information is required for proper dumping and restoring file
locks.

Signed-off-by: Andrey Vagin &lt;avagin@openvz.org&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Acked-by: Jeff Layton &lt;jlayton@poochiereds.net&gt;
Acked-by: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
Acked-by: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>locks: use cmpxchg to assign i_flctx pointer</title>
<updated>2015-04-03T13:04:04Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-04-03T13:04:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0429c2b5c1c4c8ba6cd563c1964baf3ed238df26'/>
<id>urn:sha1:0429c2b5c1c4c8ba6cd563c1964baf3ed238df26</id>
<content type='text'>
During the v3.20/v4.0 cycle, I had originally had the code manage the
inode-&gt;i_flctx pointer using a compare-and-swap operation instead of the
i_lock.

Sasha Levin though hit a problem while testing with trinity that made me
believe that that wasn't safe. At the time, changing the code to protect
the i_flctx pointer seemed to fix the issue, but I now think that was
just coincidence.

The issue was likely the same race that Kirill Shutemov hit while
testing the pre-rc1 v4.0 kernel and that Linus spotted. Due to the way
that the spinlock was dropped in the middle of flock_lock_file, you
could end up with multiple flock locks for the same struct file on the
inode.

Reinstate the use of a CAS operation to assign this pointer since it's
likely to be more efficient and gets the i_lock completely out of the
file locking business.

Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: get rid of WE_CAN_BREAK_LSLK_NOW dead code</title>
<updated>2015-04-03T13:04:04Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-04-03T13:04:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3648888e90bb7fe6d0586ec177511e6678ee22c3'/>
<id>urn:sha1:3648888e90bb7fe6d0586ec177511e6678ee22c3</id>
<content type='text'>
As Bruce points out, there's no compelling reason to change /proc/locks
output at this point. If we did want to do this, then we'd almost
certainly want to introduce a new file to display this info (maybe via
debugfs?).

Let's remove the dead WE_CAN_BREAK_LSLK_NOW ifdef here and just plan to
stay with the legacy format.

Reported-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: change lm_get_owner and lm_put_owner prototypes</title>
<updated>2015-04-03T13:04:04Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-04-03T13:04:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cae80b305e1c3944746dd93e33e9b2ccd5a490c1'/>
<id>urn:sha1:cae80b305e1c3944746dd93e33e9b2ccd5a490c1</id>
<content type='text'>
The current prototypes for these operations are somewhat awkward as they
deal with fl_owners but take struct file_lock arguments. In the future,
we'll want to be able to take references without necessarily dealing
with a struct file_lock.

Change them to take fl_owner_t arguments instead and have the callers
deal with assigning the values to the file_lock structs.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: don't allocate a lock context for an F_UNLCK request</title>
<updated>2015-04-03T13:04:03Z</updated>
<author>
<name>Jeff Layton</name>
<email>jeff.layton@primarydata.com</email>
</author>
<published>2015-04-03T13:04:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5c1c669a1b2435e071d566b6db1a8e6b26542ba1'/>
<id>urn:sha1:5c1c669a1b2435e071d566b6db1a8e6b26542ba1</id>
<content type='text'>
In the event that we get an F_UNLCK request on an inode that has no lock
context, there is no reason to allocate one. Change
locks_get_lock_context to take a "type" pointer and avoid allocating a
new context if it's F_UNLCK.

Then, fix the callers to return appropriately if that function returns
NULL.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
</content>
</entry>
<entry>
<title>locks: Add lockdep assertion for blocked_lock_lock</title>
<updated>2015-04-03T13:04:03Z</updated>
<author>
<name>Daniel Wagner</name>
<email>daniel.wagner@bmw-carit.de</email>
</author>
<published>2015-04-03T13:04:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=663d5af750b8c025d0dfea2cf2a4b4a78cafa3a7'/>
<id>urn:sha1:663d5af750b8c025d0dfea2cf2a4b4a78cafa3a7</id>
<content type='text'>
Annonate insert, remove and iterate function that we need
blocked_lock_lock held.

Signed-off-by: Daniel Wagner &lt;daniel.wagner@bmw-carit.de&gt;
Signed-off-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
</content>
</entry>
</feed>
