2019-05-19 13:08:55 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-19 13:38:35 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-24 07:44:08 -04:00
|
|
|
|
2022-11-20 09:15:34 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-09-16 19:28:13 -07:00
|
|
|
|
2008-01-17 00:07:08 +00:00
|
|
|
|
2013-06-21 08:58:18 -04:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2022-01-21 22:13:10 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-24 11:46:01 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 20:10:51 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 20:10:51 -04:00
|
|
|
|
|
|
|
|
|
2022-01-21 22:13:10 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2019-08-18 14:18:53 -04:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:18 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2013-06-21 08:58:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:18 -04:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-10-11 19:55:00 +03:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
|
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2016-01-06 21:26:10 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
2016-01-06 21:28:41 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2016-01-06 21:28:41 -05:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-06 21:28:41 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2016-01-07 15:08:51 -05:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2016-01-07 15:08:51 -05:00
|
|
|
|
2016-01-06 21:28:41 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-06 12:33:55 +02:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 12:33:55 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-10-27 15:46:08 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-07 13:06:09 +02:00
|
|
|
|
2011-07-06 12:33:55 +02:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-06 12:33:55 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-10-27 15:46:08 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-03-31 15:12:56 -05:00
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-24 12:00:08 +10:00
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
2015-04-03 09:04:04 -04:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
2015-04-03 09:04:04 -04:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
|
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
2009-03-31 15:12:56 -05:00
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
2022-05-02 14:19:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2022-05-02 14:19:24 -07:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2022-05-02 14:19:24 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
|
|
|
|
|
2022-05-02 14:19:24 -07:00
|
|
|
|
2024-01-31 18:02:00 -05:00
|
|
|
|
2022-05-02 14:19:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-10-30 17:31:15 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2010-10-30 17:31:15 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-07-07 13:06:09 +02:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-22 10:18:42 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
2006-03-20 13:44:38 -05:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
2006-03-20 13:44:38 -05:00
|
|
|
|
2014-08-22 10:18:42 -04:00
|
|
|
|
2006-03-20 13:44:38 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-11 14:09:35 -04:00
|
|
|
|
|
|
|
|
|
2006-03-20 13:44:38 -05:00
|
|
|
|
2014-08-22 10:18:42 -04:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-03-20 13:44:05 -05:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:07 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:07 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-30 23:27:35 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-30 23:27:35 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-30 23:27:35 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-18 14:20:21 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
2020-10-23 14:20:05 +08:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-10-18 14:20:21 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-10-18 14:20:21 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-01 15:06:54 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-09-01 15:06:54 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-16 22:05:57 -05:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2011-07-20 20:21:59 -04:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2018-03-21 15:09:32 -07:00
|
|
|
|
2024-01-31 18:02:10 -05:00
|
|
|
|
2006-05-07 23:02:42 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2006-05-07 23:02:42 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2007-03-01 14:34:35 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-05-07 23:02:42 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2007-03-01 14:34:35 -05:00
|
|
|
|
2006-05-07 23:02:42 -04:00
|
|
|
|
2007-03-01 14:34:35 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:01 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:01 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2024-01-31 18:02:03 -05:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:19 -04:00
|
|
|
|
2024-01-31 18:02:02 -05:00
|
|
|
|
2013-06-21 08:58:19 -04:00
|
|
|
|
2024-01-31 18:02:02 -05:00
|
|
|
|
2013-06-21 08:58:19 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:04 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:04 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:04 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:04 -05:00
|
|
|
|
2013-06-21 08:58:14 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2020-03-18 07:52:21 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2020-03-18 07:52:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2020-03-18 07:52:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:08 -05:00
|
|
|
|
|
|
|
|
|
2020-03-18 07:52:21 -04:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2024-01-31 18:02:08 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:08 -05:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2020-03-18 07:52:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:08 -05:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:07 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-18 08:33:28 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-21 08:58:16 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:16 -04:00
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2013-06-21 08:58:16 -04:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2015-02-16 14:32:03 -05:00
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
2024-01-31 18:01:45 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2007-05-11 16:09:32 -04:00
|
|
|
|
2007-02-21 00:55:18 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2007-05-11 16:09:32 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-30 11:20:02 -04:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
2014-04-22 08:24:32 -04:00
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-22 08:24:32 -04:00
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-30 11:20:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:07 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2007-10-30 11:20:02 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
|
|
|
|
|
2014-04-22 08:24:32 -04:00
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2007-10-26 18:05:40 -04:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-12 15:45:07 -04:00
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-03-31 02:30:55 -08:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2007-09-11 16:38:13 +04:00
|
|
|
|
2010-09-18 15:09:31 +02:00
|
|
|
|
|
|
|
|
|
2007-09-11 16:38:13 +04:00
|
|
|
|
|
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2010-09-18 15:09:31 +02:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:45 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
2006-03-31 02:30:55 -08:00
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-06-29 16:38:37 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2006-06-29 16:38:37 -04:00
|
|
|
|
2006-03-31 02:30:55 -08:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2006-03-31 02:30:55 -08:00
|
|
|
|
2006-06-14 17:59:35 +04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2006-03-31 02:30:55 -08:00
|
|
|
|
|
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2018-07-30 07:54:56 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-07 18:27:42 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2006-06-23 02:05:10 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2013-06-21 08:58:13 -04:00
|
|
|
|
|
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:01:45 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-23 02:05:10 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2006-06-23 02:05:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2013-06-21 08:58:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:18 -04:00
|
|
|
|
2013-06-21 08:58:12 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-05-02 14:19:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-26 01:37:26 -08:00
|
|
|
|
2014-08-22 10:18:42 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2019-03-25 08:15:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:05 -05:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
fs/locks: create a tree of dependent requests.
When we find an existing lock which conflicts with a request,
and the request wants to wait, we currently add the request
to a list. When the lock is removed, the whole list is woken.
This can cause the thundering-herd problem.
To reduce the problem, we make use of the (new) fact that
a pending request can itself have a list of blocked requests.
When we find a conflict, we look through the existing blocked requests.
If any one of them blocks the new request, the new request is attached
below that request, otherwise it is added to the list of blocked
requests, which are now known to be mutually non-conflicting.
This way, when the lock is released, only a set of non-conflicting
locks will be woken, the rest can stay asleep.
If the lock request cannot be granted and the request needs to be
requeued, all the other requests it blocks will then be woken
To make this more concrete:
If you have a many-core machine, and have many threads all wanting to
briefly lock a give file (udev is known to do this), you can get quite
poor performance.
When one thread releases a lock, it wakes up all other threads that
are waiting (classic thundering-herd) - one will get the lock and the
others go to sleep.
When you have few cores, this is not very noticeable: by the time the
4th or 5th thread gets enough CPU time to try to claim the lock, the
earlier threads have claimed it, done what was needed, and released.
So with few cores, many of the threads don't end up contending.
With 50+ cores, lost of threads can get the CPU at the same time,
and the contention can easily be measured.
This patchset creates a tree of pending lock requests in which siblings
don't conflict and each lock request does conflict with its parent.
When a lock is released, only requests which don't conflict with each
other a woken.
Testing shows that lock-acquisitions-per-second is now fairly stable
even as the number of contending process goes to 1000. Without this
patch, locks-per-second drops off steeply after a few 10s of
processes.
There is a small cost to this extra complexity.
At 20 processes running a particular test on 72 cores, the lock
acquisitions per second drops from 1.8 million to 1.4 million with
this patch. For 100 processes, this patch still provides 1.4 million
while without this patch there are about 700,000.
Reported-and-tested-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
2018-11-30 10:04:08 +11:00
|
|
|
|
2013-06-21 08:58:15 -04:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:01 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:12 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:01 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-08-25 16:25:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-08-25 16:25:35 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:13 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:45 -05:00
|
|
|
|
2013-06-21 08:58:13 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-08-12 08:03:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-08-12 08:03:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-01 17:16:16 +08:00
|
|
|
|
2014-08-12 08:03:49 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2013-06-21 08:58:13 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-23 02:05:09 -07:00
|
|
|
|
2013-06-21 08:58:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-23 02:05:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:45 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
2006-06-23 02:05:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2015-02-17 17:08:23 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2023-07-21 13:19:04 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-11 14:20:31 -04:00
|
|
|
|
2016-01-06 21:26:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-29 16:38:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
2006-03-26 01:37:26 -08:00
|
|
|
|
|
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-10-22 13:38:15 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-10-22 13:38:15 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-07 18:27:42 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2020-08-23 17:36:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:02:11 -05:00
|
|
|
|
2012-07-27 00:42:52 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2012-07-27 00:42:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2012-07-27 16:18:00 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2012-07-27 00:42:52 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2014-08-22 18:50:48 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
2019-06-05 18:45:34 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
2019-06-05 18:45:34 -07:00
|
|
|
|
2017-07-28 16:35:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2019-06-05 18:45:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2019-06-05 18:45:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2019-06-05 18:45:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
|
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
|
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-05-09 16:10:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-12-24 06:47:55 -05:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-12-24 06:47:55 -05:00
|
|
|
|
2011-12-26 10:25:26 -08:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2019-08-19 18:47:34 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:06 -05:00
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-09-01 15:06:54 -04:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2014-09-01 15:06:54 -04:00
|
|
|
|
|
|
|
|
|
2014-09-01 14:27:43 -04:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2014-04-15 06:17:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-04-15 06:17:49 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:09 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-01 14:53:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2019-08-19 18:47:34 -05:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-03 17:14:34 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-01-03 17:14:34 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-19 17:01:00 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
vfs: change inode times to use struct timespec64
struct timespec is not y2038 safe. Transition vfs to use
y2038 safe struct timespec64 instead.
The change was made with the help of the following cocinelle
script. This catches about 80% of the changes.
All the header file and logic changes are included in the
first 5 rules. The rest are trivial substitutions.
I avoid changing any of the function signatures or any other
filesystem specific data structures to keep the patch simple
for review.
The script can be a little shorter by combining different cases.
But, this version was sufficient for my usecase.
virtual patch
@ depends on patch @
identifier now;
@@
- struct timespec
+ struct timespec64
current_time ( ... )
{
- struct timespec now = current_kernel_time();
+ struct timespec64 now = current_kernel_time64();
...
- return timespec_trunc(
+ return timespec64_trunc(
... );
}
@ depends on patch @
identifier xtime;
@@
struct \( iattr \| inode \| kstat \) {
...
- struct timespec xtime;
+ struct timespec64 xtime;
...
}
@ depends on patch @
identifier t;
@@
struct inode_operations {
...
int (*update_time) (...,
- struct timespec t,
+ struct timespec64 t,
...);
...
}
@ depends on patch @
identifier t;
identifier fn_update_time =~ "update_time$";
@@
fn_update_time (...,
- struct timespec *t,
+ struct timespec64 *t,
...) { ... }
@ depends on patch @
identifier t;
@@
lease_get_mtime( ... ,
- struct timespec *t
+ struct timespec64 *t
) { ... }
@te depends on patch forall@
identifier ts;
local idexpression struct inode *inode_node;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
identifier fn_update_time =~ "update_time$";
identifier fn;
expression e, E3;
local idexpression struct inode *node1;
local idexpression struct inode *node2;
local idexpression struct iattr *attr1;
local idexpression struct iattr *attr2;
local idexpression struct iattr attr;
identifier i_xtime1 =~ "^i_[acm]time$";
identifier i_xtime2 =~ "^i_[acm]time$";
identifier ia_xtime1 =~ "^ia_[acm]time$";
identifier ia_xtime2 =~ "^ia_[acm]time$";
@@
(
(
- struct timespec ts;
+ struct timespec64 ts;
|
- struct timespec ts = current_time(inode_node);
+ struct timespec64 ts = current_time(inode_node);
)
<+... when != ts
(
- timespec_equal(&inode_node->i_xtime, &ts)
+ timespec64_equal(&inode_node->i_xtime, &ts)
|
- timespec_equal(&ts, &inode_node->i_xtime)
+ timespec64_equal(&ts, &inode_node->i_xtime)
|
- timespec_compare(&inode_node->i_xtime, &ts)
+ timespec64_compare(&inode_node->i_xtime, &ts)
|
- timespec_compare(&ts, &inode_node->i_xtime)
+ timespec64_compare(&ts, &inode_node->i_xtime)
|
ts = current_time(e)
|
fn_update_time(..., &ts,...)
|
inode_node->i_xtime = ts
|
node1->i_xtime = ts
|
ts = inode_node->i_xtime
|
<+... attr1->ia_xtime ...+> = ts
|
ts = attr1->ia_xtime
|
ts.tv_sec
|
ts.tv_nsec
|
btrfs_set_stack_timespec_sec(..., ts.tv_sec)
|
btrfs_set_stack_timespec_nsec(..., ts.tv_nsec)
|
- ts = timespec64_to_timespec(
+ ts =
...
-)
|
- ts = ktime_to_timespec(
+ ts = ktime_to_timespec64(
...)
|
- ts = E3
+ ts = timespec_to_timespec64(E3)
|
- ktime_get_real_ts(&ts)
+ ktime_get_real_ts64(&ts)
|
fn(...,
- ts
+ timespec64_to_timespec(ts)
,...)
)
...+>
(
<... when != ts
- return ts;
+ return timespec64_to_timespec(ts);
...>
)
|
- timespec_equal(&node1->i_xtime1, &node2->i_xtime2)
+ timespec64_equal(&node1->i_xtime2, &node2->i_xtime2)
|
- timespec_equal(&node1->i_xtime1, &attr2->ia_xtime2)
+ timespec64_equal(&node1->i_xtime2, &attr2->ia_xtime2)
|
- timespec_compare(&node1->i_xtime1, &node2->i_xtime2)
+ timespec64_compare(&node1->i_xtime1, &node2->i_xtime2)
|
node1->i_xtime1 =
- timespec_trunc(attr1->ia_xtime1,
+ timespec64_trunc(attr1->ia_xtime1,
...)
|
- attr1->ia_xtime1 = timespec_trunc(attr2->ia_xtime2,
+ attr1->ia_xtime1 = timespec64_trunc(attr2->ia_xtime2,
...)
|
- ktime_get_real_ts(&attr1->ia_xtime1)
+ ktime_get_real_ts64(&attr1->ia_xtime1)
|
- ktime_get_real_ts(&attr.ia_xtime1)
+ ktime_get_real_ts64(&attr.ia_xtime1)
)
@ depends on patch @
struct inode *node;
struct iattr *attr;
identifier fn;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
expression e;
@@
(
- fn(node->i_xtime);
+ fn(timespec64_to_timespec(node->i_xtime));
|
fn(...,
- node->i_xtime);
+ timespec64_to_timespec(node->i_xtime));
|
- e = fn(attr->ia_xtime);
+ e = fn(timespec64_to_timespec(attr->ia_xtime));
)
@ depends on patch forall @
struct inode *node;
struct iattr *attr;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
identifier fn;
@@
{
+ struct timespec ts;
<+...
(
+ ts = timespec64_to_timespec(node->i_xtime);
fn (...,
- &node->i_xtime,
+ &ts,
...);
|
+ ts = timespec64_to_timespec(attr->ia_xtime);
fn (...,
- &attr->ia_xtime,
+ &ts,
...);
)
...+>
}
@ depends on patch forall @
struct inode *node;
struct iattr *attr;
struct kstat *stat;
identifier ia_xtime =~ "^ia_[acm]time$";
identifier i_xtime =~ "^i_[acm]time$";
identifier xtime =~ "^[acm]time$";
identifier fn, ret;
@@
{
+ struct timespec ts;
<+...
(
+ ts = timespec64_to_timespec(node->i_xtime);
ret = fn (...,
- &node->i_xtime,
+ &ts,
...);
|
+ ts = timespec64_to_timespec(node->i_xtime);
ret = fn (...,
- &node->i_xtime);
+ &ts);
|
+ ts = timespec64_to_timespec(attr->ia_xtime);
ret = fn (...,
- &attr->ia_xtime,
+ &ts,
...);
|
+ ts = timespec64_to_timespec(attr->ia_xtime);
ret = fn (...,
- &attr->ia_xtime);
+ &ts);
|
+ ts = timespec64_to_timespec(stat->xtime);
ret = fn (...,
- &stat->xtime);
+ &ts);
)
...+>
}
@ depends on patch @
struct inode *node;
struct inode *node2;
identifier i_xtime1 =~ "^i_[acm]time$";
identifier i_xtime2 =~ "^i_[acm]time$";
identifier i_xtime3 =~ "^i_[acm]time$";
struct iattr *attrp;
struct iattr *attrp2;
struct iattr attr ;
identifier ia_xtime1 =~ "^ia_[acm]time$";
identifier ia_xtime2 =~ "^ia_[acm]time$";
struct kstat *stat;
struct kstat stat1;
struct timespec64 ts;
identifier xtime =~ "^[acmb]time$";
expression e;
@@
(
( node->i_xtime2 \| attrp->ia_xtime2 \| attr.ia_xtime2 \) = node->i_xtime1 ;
|
node->i_xtime2 = \( node2->i_xtime1 \| timespec64_trunc(...) \);
|
node->i_xtime2 = node->i_xtime1 = node->i_xtime3 = \(ts \| current_time(...) \);
|
node->i_xtime1 = node->i_xtime3 = \(ts \| current_time(...) \);
|
stat->xtime = node2->i_xtime1;
|
stat1.xtime = node2->i_xtime1;
|
( node->i_xtime2 \| attrp->ia_xtime2 \) = attrp->ia_xtime1 ;
|
( attrp->ia_xtime1 \| attr.ia_xtime1 \) = attrp2->ia_xtime2;
|
- e = node->i_xtime1;
+ e = timespec64_to_timespec( node->i_xtime1 );
|
- e = attrp->ia_xtime1;
+ e = timespec64_to_timespec( attrp->ia_xtime1 );
|
node->i_xtime1 = current_time(...);
|
node->i_xtime2 = node->i_xtime1 = node->i_xtime3 =
- e;
+ timespec_to_timespec64(e);
|
node->i_xtime1 = node->i_xtime3 =
- e;
+ timespec_to_timespec64(e);
|
- node->i_xtime1 = e;
+ node->i_xtime1 = timespec_to_timespec64(e);
)
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: <anton@tuxera.com>
Cc: <balbi@kernel.org>
Cc: <bfields@fieldses.org>
Cc: <darrick.wong@oracle.com>
Cc: <dhowells@redhat.com>
Cc: <dsterba@suse.com>
Cc: <dwmw2@infradead.org>
Cc: <hch@lst.de>
Cc: <hirofumi@mail.parknet.co.jp>
Cc: <hubcap@omnibond.com>
Cc: <jack@suse.com>
Cc: <jaegeuk@kernel.org>
Cc: <jaharkes@cs.cmu.edu>
Cc: <jslaby@suse.com>
Cc: <keescook@chromium.org>
Cc: <mark@fasheh.com>
Cc: <miklos@szeredi.hu>
Cc: <nico@linaro.org>
Cc: <reiserfs-devel@vger.kernel.org>
Cc: <richard@nod.at>
Cc: <sage@redhat.com>
Cc: <sfrench@samba.org>
Cc: <swhiteho@redhat.com>
Cc: <tj@kernel.org>
Cc: <trond.myklebust@primarydata.com>
Cc: <tytso@mit.edu>
Cc: <viro@zeniv.linux.org.uk>
2018-05-08 19:36:02 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-08-22 10:18:44 -04:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-08-22 10:18:44 -04:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-18 21:40:33 +08:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2014-08-22 10:18:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-14 07:48:06 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2016-09-16 12:44:20 +02:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2011-07-26 18:25:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2016-10-08 10:12:28 +02:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2015-08-09 18:43:17 -07:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-01 15:05:33 +00:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2015-01-21 19:17:03 +01:00
|
|
|
|
|
|
|
|
|
2021-04-16 14:00:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-21 19:17:03 +01:00
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2019-06-07 17:24:38 +03:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:40:25 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-08-19 10:59:49 -04:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-10-30 17:31:14 -04:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
|
|
|
|
|
2015-04-03 09:04:03 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-22 15:40:57 -05:00
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
|
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
2010-10-30 17:31:14 -04:00
|
|
|
|
2007-05-31 17:03:46 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-19 10:59:49 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2011-08-19 10:59:49 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2011-08-19 10:59:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2011-08-19 10:59:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-03-04 17:34:32 -05:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2014-02-03 12:13:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:12 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2012-03-05 13:18:59 -05:00
|
|
|
|
2016-01-22 15:40:57 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
2015-01-21 19:14:02 +01:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
2014-08-22 10:18:45 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2014-08-22 10:18:45 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
2015-03-14 09:45:35 -04:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2014-09-01 07:12:07 -04:00
|
|
|
|
2014-08-22 10:18:45 -04:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-08-22 10:40:25 -04:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-21 19:14:02 +01:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:18:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-21 19:17:03 +01:00
|
|
|
|
2014-08-22 10:40:25 -04:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
2012-07-13 13:35:36 -04:00
|
|
|
|
2011-09-21 08:34:32 -04:00
|
|
|
|
|
|
|
|
|
2007-07-31 00:39:22 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-08-18 14:18:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2019-08-18 14:18:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-05 07:09:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-18 15:09:31 +02:00
|
|
|
|
2014-08-22 18:13:28 -04:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2014-08-22 18:13:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:18 -04:00
|
|
|
|
|
|
|
|
|
2014-08-22 18:13:28 -04:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-08-22 10:40:25 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-02-05 07:09:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-06-07 17:09:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-02-01 15:05:33 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2010-10-27 12:38:12 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2010-10-27 15:46:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-10-27 12:38:12 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2010-10-27 12:38:12 -04:00
|
|
|
|
|
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2010-10-27 12:38:12 -04:00
|
|
|
|
2014-08-22 10:55:47 -04:00
|
|
|
|
2014-08-11 18:14:12 -04:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2010-10-27 12:38:12 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-30 17:31:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-01 15:05:33 +00:00
|
|
|
|
2010-10-30 17:31:13 -04:00
|
|
|
|
|
|
|
|
|
2015-01-21 19:14:02 +01:00
|
|
|
|
2010-10-30 17:31:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-10-22 13:38:15 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-22 13:38:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2015-10-22 13:38:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:18 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-05-27 06:07:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-14 14:14:18 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-18 15:43:57 -08:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-09-04 10:25:06 -04:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2018-07-18 15:44:43 +02:00
|
|
|
|
2012-08-28 12:52:22 -04:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2022-08-17 19:41:27 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-08-28 12:52:22 -04:00
|
|
|
|
2022-07-16 21:35:32 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-21 00:58:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-11 16:22:50 -04:00
|
|
|
|
2007-02-21 00:58:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2018-07-18 15:44:43 +02:00
|
|
|
|
2007-02-21 00:58:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-21 11:21:47 +02:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
2024-01-31 18:01:57 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:57 -05:00
|
|
|
|
2018-06-08 17:27:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:13 -05:00
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2007-02-21 00:58:50 -05:00
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2007-02-20 16:10:11 -05:00
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-18 15:08:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locks: add fl_grant callback for asynchronous lock return
Acquiring a lock on a cluster filesystem may require communication with
remote hosts, and to avoid blocking lockd or nfsd threads during such
communication, we allow the results to be returned asynchronously.
When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the
routine in the fl_grant field of the lock_manager_operations struct.
This differs from the case when ->lock returns -EAGAIN to a blocking
lock request; in that case, the filesystem calls fl_notify when the lock
is granted, and the caller retries the original lock. So while
fl_notify is merely a hint to the caller that it should retry, fl_grant
actually communicates the final result of the lock operation (with the
lock already acquired in the succesful case).
Therefore fl_grant takes a lock, a status and, for the test lock case, a
conflicting lock. We also allow fl_grant to return an error to the
filesystem, to handle the case where the fl_grant requests arrives after
the lock manager has already given up waiting for it.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2006-12-05 23:31:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-12 17:53:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locks: add fl_grant callback for asynchronous lock return
Acquiring a lock on a cluster filesystem may require communication with
remote hosts, and to avoid blocking lockd or nfsd threads during such
communication, we allow the results to be returned asynchronously.
When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the
routine in the fl_grant field of the lock_manager_operations struct.
This differs from the case when ->lock returns -EAGAIN to a blocking
lock request; in that case, the filesystem calls fl_notify when the lock
is granted, and the caller retries the original lock. So while
fl_notify is merely a hint to the caller that it should retry, fl_grant
actually communicates the final result of the lock operation (with the
lock already acquired in the succesful case).
Therefore fl_grant takes a lock, a status and, for the test lock case, a
conflicting lock. We also allow fl_grant to return an error to the
filesystem, to handle the case where the fl_grant requests arrives after
the lock manager has already given up waiting for it.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2006-12-05 23:31:28 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
|
|
|
|
|
locks: add fl_grant callback for asynchronous lock return
Acquiring a lock on a cluster filesystem may require communication with
remote hosts, and to avoid blocking lockd or nfsd threads during such
communication, we allow the results to be returned asynchronously.
When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the
routine in the fl_grant field of the lock_manager_operations struct.
This differs from the case when ->lock returns -EAGAIN to a blocking
lock request; in that case, the filesystem calls fl_notify when the lock
is granted, and the caller retries the original lock. So while
fl_notify is merely a hint to the caller that it should retry, fl_grant
actually communicates the final result of the lock operation (with the
lock already acquired in the succesful case).
Therefore fl_grant takes a lock, a status and, for the test lock case, a
conflicting lock. We also allow fl_grant to return an error to the
filesystem, to handle the case where the fl_grant requests arrives after
the lock manager has already given up waiting for it.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2006-12-05 23:31:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-20 20:21:59 -04:00
|
|
|
|
locks: add fl_grant callback for asynchronous lock return
Acquiring a lock on a cluster filesystem may require communication with
remote hosts, and to avoid blocking lockd or nfsd threads during such
communication, we allow the results to be returned asynchronously.
When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the
routine in the fl_grant field of the lock_manager_operations struct.
This differs from the case when ->lock returns -EAGAIN to a blocking
lock request; in that case, the filesystem calls fl_notify when the lock
is granted, and the caller retries the original lock. So while
fl_notify is merely a hint to the caller that it should retry, fl_grant
actually communicates the final result of the lock operation (with the
lock already acquired in the succesful case).
Therefore fl_grant takes a lock, a status and, for the test lock case, a
conflicting lock. We also allow fl_grant to return an error to the
filesystem, to handle the case where the fl_grant requests arrives after
the lock manager has already given up waiting for it.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2006-12-05 23:31:28 -05:00
|
|
|
|
2007-01-18 15:08:55 -05:00
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
2007-01-18 15:08:55 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2018-07-18 15:44:43 +02:00
|
|
|
|
2007-01-18 15:08:55 -05:00
|
|
|
|
|
|
|
|
|
2007-01-18 16:15:35 -05:00
|
|
|
|
2007-01-18 15:08:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-25 01:48:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
|
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-15 09:07:07 -04:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2008-05-06 13:58:34 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2014-04-22 08:24:32 -04:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2020-08-23 17:36:59 -05:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2016-01-08 07:30:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2020-11-20 17:14:25 -06:00
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-20 17:14:25 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2016-01-06 21:26:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2023-06-22 21:52:23 +05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2007-02-21 00:58:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2014-08-22 10:18:43 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-07-16 10:28:21 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-05-06 13:58:34 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2014-05-09 11:41:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2014-04-22 08:24:32 -04:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
|
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2014-04-22 08:23:58 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
2017-05-27 06:07:19 -04:00
|
|
|
|
2014-03-04 10:30:23 -05:00
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2020-08-23 17:36:59 -05:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2008-07-25 01:48:57 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2016-01-08 07:30:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 11:45:09 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2020-11-20 17:14:25 -06:00
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-20 17:14:25 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2016-01-07 16:38:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-06 21:26:10 -05:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2006-06-23 02:05:11 -07:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-06 21:26:10 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 12:44:20 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:58 -05:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-01-16 15:05:58 -05:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
2022-07-16 21:35:31 -07:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2018-11-30 10:04:08 +11:00
|
|
|
|
2018-07-18 15:44:43 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
2015-07-11 06:43:02 -04:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:58 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:58 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
|
|
|
|
|
2015-02-16 19:37:42 -05:00
|
|
|
|
2015-01-16 15:05:57 -05:00
|
|
|
|
2019-02-21 15:38:40 +01:00
|
|
|
|
2016-10-08 10:12:28 +02:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:13:08 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
|
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:58 -05:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2014-07-13 17:00:38 +02:00
|
|
|
|
2014-02-03 12:13:10 -05:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2015-01-16 15:05:55 -05:00
|
|
|
|
2015-09-21 09:43:06 +02:00
|
|
|
|
2017-07-21 13:36:25 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2007-01-18 17:52:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2018-07-18 15:44:43 +02:00
|
|
|
|
2007-01-18 17:52:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-14 08:33:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2022-11-14 08:33:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2008-10-04 22:34:18 +04:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:44 -05:00
|
|
|
|
2020-05-18 20:07:38 +02:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-17 00:07:08 +00:00
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
2018-06-08 17:27:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
atomic with the stateid update", NFSv4 has been inserting locks in rpciod
worker context. The result is that the file_lock's fl_nspid is the
kworker's pid instead of the original userspace pid.
The fl_nspid is only used to represent the namespaced virtual pid number
when displaying locks or returning from F_GETLK. There's no reason to set
it for every inserted lock, since we can usually just look it up from
fl_pid. So, instead of looking up and holding struct pid for every lock,
let's just look up the virtual pid number from fl_pid when it is needed.
That means we can remove fl_nspid entirely.
The translaton and presentation of fl_pid should handle the following four
cases:
1 - F_GETLK on a remote file with a remote lock:
In this case, the filesystem should determine the l_pid to return here.
Filesystems should indicate that the fl_pid represents a non-local pid
value that should not be translated by returning an fl_pid <= 0.
2 - F_GETLK on a local file with a remote lock:
This should be the l_pid of the lock manager process, and translated.
3 - F_GETLK on a remote file with a local lock, and
4 - F_GETLK on a local file with a local lock:
These should be the translated l_pid of the local locking process.
Fuse was already doing the correct thing by translating the pid into the
caller's namespace. With this change we must update fuse to translate
to init's pid namespace, so that the locks API can then translate from
init's pid namespace into the pid namespace of the caller.
With this change, the locks API will expect that if a filesystem returns
a remote pid as opposed to a local pid for F_GETLK, that remote pid will
be <= 0. This signifies that the pid is remote, and the locks API will
forego translating that pid into the pid namespace of the local calling
process.
Finally, we convert remote filesystems to present remote pids using
negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
pid returned for F_GETLK lock requests.
Since local pids will never be larger than PID_MAX_LIMIT (which is
currently defined as <= 4 million), but pid_t is an unsigned int, we
should have plenty of room to represent remote pids with negative
numbers if we assume that remote pid numbers are similarly limited.
If this is not the case, then we run the risk of having a remote pid
returned for which there is also a corresponding local pid. This is a
problem we have now, but this patch should reduce the chances of that
occurring, while also returning those remote pid numbers, for whatever
that may be worth.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2017-07-16 10:28:22 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2014-02-03 12:13:09 -05:00
|
|
|
|
|
|
|
|
|
2021-08-19 14:56:38 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:57 -05:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2014-08-11 13:36:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-24 20:16:31 +03:00
|
|
|
|
2021-09-10 15:36:29 -04:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-04-03 09:04:04 -04:00
|
|
|
|
2024-01-31 18:01:44 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:01:44 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-05-09 14:13:05 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:07 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2020-05-18 20:07:38 +02:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2016-08-17 16:18:46 -04:00
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2024-01-31 18:01:59 -05:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
|
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-02 11:21:34 -07:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
2024-01-31 18:02:14 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-25 22:58:29 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-25 08:48:37 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-16 09:02:30 -05:00
|
|
|
|
2015-04-16 12:49:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2014-02-03 12:13:07 -05:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2010-10-26 14:22:33 -07:00
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2014-02-03 12:13:07 -05:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
2013-06-21 08:58:20 -04:00
|
|
|
|
2015-06-22 14:16:33 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-10-04 22:34:18 +04:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-04 22:34:18 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-24 17:05:17 +02:00
|
|
|
|
|
|
|
|
|
2008-10-04 22:34:18 +04:00
|
|
|
|
|
|
|
|
|
2015-12-17 14:11:03 -05:00
|
|
|
|
2007-10-01 14:41:15 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
|
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2021-09-07 11:21:48 -07:00
|
|
|
|
2015-01-16 15:05:54 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2021-09-07 11:21:48 -07:00
|
|
|
|
2011-07-07 13:06:09 +02:00
|
|
|
|
2024-01-31 18:02:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-22 14:16:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:58:22 -04:00
|
|
|
|
2019-08-18 14:18:45 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|