* [PATCH v2] filelock: don't hand out a delegation that is being recalled
@ 2026-12-04 2:49 Hungyu Lin
2026-12-04 3:14 ` sashiko-bot
2026-12-04 11:46 ` Jeff Layton
0 siblings, 2 replies; 3+ messages in thread
From: Hungyu Lin @ 2026-12-04 2:49 UTC (permalink / raw)
To: jlayton
Cc: cel, alex.aring, viro, brauner, jack, dai.ngo, mjguzik,
zhaogongyi, rostedt, mhiramat, mathieu.desnoyers, linux-fsdevel,
linux-trace-kernel, linux-kernel, dennylin0707
An operation that finds a conflicting delegation gets -EWOULDBLOCK from
try_break_deleg(), drops its locks, waits in break_deleg_wait() and then
retries. Nothing stops a new delegation from being set on the inode in
the meantime.
With F_SETDELEG the owner of a file can do that from userspace: remove
the delegation when it is recalled and request it again right away. The
waiter in __break_lease() then finds a delegation that was never asked
to be returned. It has no break time, so it never times out and its
holder is not signalled again, and the waiter keeps waiting for it.
As a result unlink(), rename(), chmod() and chown() of the file hang
until they are interrupted, no matter who calls them and what
lease-break-time is set to. A delegation on a directory does the same
to a create in that directory.
When __break_lease() wakes up and still finds a conflicting lease, go
back and break the ones that were set while it was waiting, the same
way as the ones it found on entry.
That alone is not enough, because the holder can keep returning the
delegation and requesting it again. So when a breaker that has already
waited once finds a new delegation, either on waking up or when its
caller retries after break_deleg_wait(), stop handing out userland
delegations on that inode for twice the lease break time. That leaves
the breaker enough time to get the last one back and to go through.
As long as no delegation is set while one is being recalled, nothing
changes: a delegation can be requested again as soon as the conflicting
operation went through. nfsd already keeps track of recalled delegations
by itself and is left alone.
Fixes: 1602bad16d7d ("vfs: expose delegation support to userland")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
Changes in v2:
- v1 lifted the block as soon as any non-blocking delegation break found
nothing left to break. The holder could cause that itself, for example
with futimens() on the file, and take the delegation again. The block
is no longer lifted early. Instead it is only set once a breaker has
to wait a second time.
- Break the leases that are set while __break_lease() is waiting.
v1: https://lore.kernel.org/all/20261116061502.44674-1-dennylin0707@gmail.com/
fs/locks.c | 21 ++++++++++++++++++---
include/linux/filelock.h | 9 ++++++++-
include/trace/events/filelock.h | 3 ++-
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index 6e4ff7fcec05..2c7af1b7b9c6 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -190,6 +190,7 @@ locks_get_lock_context(struct inode *inode, int type)
INIT_LIST_HEAD(&ctx->flc_flock);
INIT_LIST_HEAD(&ctx->flc_posix);
INIT_LIST_HEAD(&ctx->flc_lease);
+ ctx->flc_deleg_blocked_until = 0;
/*
* Assign the pointer if it's not already assigned. If it is, then
@@ -1681,6 +1682,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
unsigned int type;
LIST_HEAD(dispose);
bool want_write = !(flags & LEASE_BREAK_OPEN_RDONLY);
+ bool retry = flags & LEASE_BREAK_RETRY;
int error = 0;
trace_break_lease(inode, flags);
@@ -1708,6 +1710,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
if (!first_visible_lease(inode, new_fl, flags))
goto out;
+restart:
break_time = 0;
if (lease_break_time > 0) {
break_time = jiffies + lease_break_time * HZ;
@@ -1731,6 +1734,9 @@ int __break_lease(struct inode *inode, unsigned int flags)
fl->c.flc_flags |= FL_DOWNGRADE_PENDING;
fl->fl_downgrade_time = break_time;
}
+ if (retry && type == FL_DELEG && lease_break_time > 0)
+ ctx->flc_deleg_blocked_until = get_jiffies_64() +
+ 2 * (u64)lease_break_time * HZ;
if (fl->fl_lmops->lm_break(fl))
locks_delete_lock_ctx(&fl->c, &dispose);
}
@@ -1745,7 +1751,6 @@ int __break_lease(struct inode *inode, unsigned int flags)
goto out;
}
-restart:
break_time = fl->fl_break_time;
if (break_time != 0) {
if (time_after(jiffies, break_time)) {
@@ -1776,9 +1781,10 @@ int __break_lease(struct inode *inode, unsigned int flags)
*/
if (error == 0)
time_out_leases(inode, &dispose);
- fl = first_visible_lease(inode, new_fl, flags);
- if (fl)
+ if (first_visible_lease(inode, new_fl, flags)) {
+ retry = true;
goto restart;
+ }
error = 0;
}
out:
@@ -1968,6 +1974,15 @@ generic_add_lease(struct file *filp, int arg, struct file_lease **flp, void **pr
if (!leases_enable)
goto out;
+ /*
+ * Don't hand out a new delegation while __break_lease() is having
+ * trouble getting the previous ones returned.
+ */
+ error = -EAGAIN;
+ if (is_deleg && lease->fl_lmops == &lease_manager_ops &&
+ time_before64(get_jiffies_64(), ctx->flc_deleg_blocked_until))
+ goto out;
+
locks_insert_lock_ctx(&lease->c, &ctx->flc_lease);
/*
* The check in break_lease() is lockless. It's possible for another
diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index e909db319067..6b5ec34c9b6e 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -37,6 +37,7 @@
#define LEASE_BREAK_DIR_CREATE BIT(5) // dir deleg create event
#define LEASE_BREAK_DIR_DELETE BIT(6) // dir deleg delete event
#define LEASE_BREAK_DIR_RENAME BIT(7) // dir deleg rename event
+#define LEASE_BREAK_RETRY BIT(8) // retry after waiting for a break
struct file_lock;
struct file_lease;
@@ -158,6 +159,7 @@ struct file_lock_context {
struct list_head flc_flock;
struct list_head flc_posix;
struct list_head flc_lease;
+ u64 flc_deleg_blocked_until;
};
#ifdef CONFIG_FILE_LOCKING
@@ -515,6 +517,7 @@ static inline int break_deleg(struct inode *inode, unsigned int flags)
struct delegated_inode {
struct inode *di_inode;
+ bool di_waited;
};
static inline bool is_delegated(struct delegated_inode *di)
@@ -541,7 +544,10 @@ static inline int try_break_deleg(struct inode *inode, unsigned int flags,
{
int ret;
- ret = break_deleg(inode, flags | LEASE_BREAK_NONBLOCK);
+ flags |= LEASE_BREAK_NONBLOCK;
+ if (di && di->di_waited)
+ flags |= LEASE_BREAK_RETRY;
+ ret = break_deleg(inode, flags);
if (ret == -EWOULDBLOCK && di) {
di->di_inode = inode;
ihold(inode);
@@ -561,6 +567,7 @@ static inline int break_deleg_wait(struct delegated_inode *di)
iput(inode);
deactivate_super(sb);
di->di_inode = NULL;
+ di->di_waited = true;
return ret;
}
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index f11284be01ea..02b0f0687afc 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -129,7 +129,8 @@ DEFINE_EVENT(filelock_lock, flock_lock_inode,
{ LEASE_BREAK_OPEN_RDONLY, "OPEN_RDONLY" }, \
{ LEASE_BREAK_DIR_CREATE, "DIR_CREATE" }, \
{ LEASE_BREAK_DIR_DELETE, "DIR_DELETE" }, \
- { LEASE_BREAK_DIR_RENAME, "DIR_RENAME" })
+ { LEASE_BREAK_DIR_RENAME, "DIR_RENAME" }, \
+ { LEASE_BREAK_RETRY, "RETRY" })
TRACE_EVENT(break_lease,
TP_PROTO(struct inode *inode, unsigned int flags),
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] filelock: don't hand out a delegation that is being recalled
2026-12-04 2:49 [PATCH v2] filelock: don't hand out a delegation that is being recalled Hungyu Lin
@ 2026-12-04 3:14 ` sashiko-bot
2026-12-04 11:46 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-04 3:14 UTC (permalink / raw)
To: Hungyu Lin; +Cc: linux-trace-kernel
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] filelock: __break_lease() skips delegation block when
FL_UNLOCK_PENDING is set
- [Medium] filelock: di_waited in struct delegated_inode triggers retry
across inodes
- [Medium] filelock: __break_lease() and try_break_deleg() miss open(3)
and nfsd
- [Medium] filelock: __break_lease() rescans all leases on every wakeup
(O(N^2))
--
commit df9b5ca846e82763521dadf099ffefce3e79aadd
Author: Hungyu Lin <dennylin0707@gmail.com>
filelock: don't hand out a delegation that is being recalled
This commit changes __break_lease() to loop back and break leases added while
waiting, and blocks new userland F_SETDELEG delegations on the inode for
twice lease_break_time when a breaker encounters a conflicting delegation on
retry.
> diff --git a/fs/locks.c b/fs/locks.c
> index 6e4ff7fcec053..2c7af1b7b9c63 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
[ ... ]
> @@ -1708,6 +1710,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
> if (!first_visible_lease(inode, new_fl, flags))
> goto out;
>
> +restart:
> break_time = 0;
> if (lease_break_time > 0) {
> break_time = jiffies + lease_break_time * HZ;
> @@ -1731,6 +1734,9 @@ int __break_lease(struct inode *inode, unsigned int flags)
> fl->c.flc_flags |= FL_DOWNGRADE_PENDING;
> fl->fl_downgrade_time = break_time;
> }
> + if (retry && type == FL_DELEG && lease_break_time > 0)
> + ctx->flc_deleg_blocked_until = get_jiffies_64() +
> + 2 * (u64)lease_break_time * HZ;
> if (fl->fl_lmops->lm_break(fl))
> locks_delete_lock_ctx(&fl->c, &dispose);
> }
[Severity: High]
Can an unprivileged file owner bypass ctx->flc_deleg_blocked_until because it
is set after the FL_UNLOCK_PENDING and lease_breaking() continue statements?
CPU0 (victim) CPU1 (delegation holder)
try_break_deleg() -> -EWOULDBLOCK
break_deleg_wait() -> sleeps
fcntl(F_SETDELEG, F_UNLCK)
fcntl(F_SETDELEG, F_RDLCK) [D2]
open(O_WRONLY | O_NONBLOCK)
sets FL_UNLOCK_PENDING on D2
wakes, retry=true, goto restart
FL_UNLOCK_PENDING -> continue
flc_deleg_blocked_until stays 0 <-- sleeps on D2 again
Because open(O_WRONLY | O_NONBLOCK) enters do_dentry_open() -> break_lease()
with retry == false, it marks the freshly re-acquired delegation D2 with
FL_UNLOCK_PENDING without arming flc_deleg_blocked_until and returns
-EWOULDBLOCK immediately. When the victim wakes or retries with retry ==
true, the loop hits continue and skips setting flc_deleg_blocked_until,
allowing the holder to hang unlink(), rename(), chmod(), or chown() until
interrupted.
Separately, break_deleg_wait() calls break_deleg(inode, 0) without passing
LEASE_BREAK_RETRY when di->di_waited is already true, so if D2 is replaced
before break_deleg_wait() runs, retry starts false again. Updating
flc_deleg_blocked_until before the continue skips (or after
first_visible_lease() succeeds) and forwarding LEASE_BREAK_RETRY from
break_deleg_wait() would close both gaps.
[Severity: Medium]
Should this check fl->c.flc_flags & FL_DELEG rather than type == FL_DELEG?
break_lease() passes LEASE_BREAK_LEASE (type == FL_LEASE), so it never sets
flc_deleg_blocked_until when breaking a userland delegation. An open() with
O_ACCMODE == 3 (O_WRONLY | O_RDWR) leaves f->f_mode == 0, so do_dentry_open()
increments neither i_readcount nor i_writecount before calling break_lease(),
letting the holder unlock on SIGIO and re-acquire the delegation indefinitely
without hitting lease_open_conflict() and hanging open(path, 3).
Separately, try_break_deleg() only sets LEASE_BREAK_RETRY when di &&
di->di_waited is true, so nfsd callers that pass a NULL delegated_inode (such
as nfsd_unlink() -> vfs_unlink(..., NULL)) never arm flc_deleg_blocked_until
across retries. A local file owner can repeatedly unlock and re-acquire an
F_SETDELEG delegation on recall and starve remote NFS clients with
NFS4ERR_DELAY/NFS3ERR_JUKEBOX.
> @@ -1745,7 +1751,6 @@ int __break_lease(struct inode *inode, unsigned int flags)
> goto out;
> }
>
> -restart:
> break_time = fl->fl_break_time;
> if (break_time != 0) {
> if (time_after(jiffies, break_time)) {
> @@ -1776,9 +1781,10 @@ int __break_lease(struct inode *inode, unsigned int flags)
> */
> if (error == 0)
> time_out_leases(inode, &dispose);
> - fl = first_visible_lease(inode, new_fl, flags);
> - if (fl)
> + if (first_visible_lease(inode, new_fl, flags)) {
> + retry = true;
> goto restart;
> + }
> error = 0;
> }
[Severity: Medium]
Does jumping back to restart above list_for_each_entry_safe() turn
multi-holder recalls into O(N^2) scanning under ctx->flc_lock?
When N shared read leases or delegations are returned in order, each wakeup
discards the first_visible_lease() result, rescans all remaining entries on
ctx->flc_lease under spin_lock(&ctx->flc_lock) (calling leases_conflict() on
each before skipping FL_UNLOCK_PENDING), and calls first_visible_lease() a
second time. For NFSv4 delegations, where nfsd_break_deleg_cb() sets
fl->fl_break_time = 0 and waiters wake every jiffy, this also adds a second
full-list scan on top of time_out_leases() every tick.
Tracking insertions with a generation counter in struct file_lock_context
(incremented in generic_add_lease()) would let __break_lease() rescan only
when a new lease was actually inserted while waiting.
[ ... ]
> diff --git a/include/linux/filelock.h b/include/linux/filelock.h
> index e909db319067f..6b5ec34c9b6e6 100644
> --- a/include/linux/filelock.h
> +++ b/include/linux/filelock.h
[ ... ]
> @@ -541,7 +544,10 @@ static inline int try_break_deleg(struct inode *inode, unsigned int flags,
> {
> int ret;
>
> - ret = break_deleg(inode, flags | LEASE_BREAK_NONBLOCK);
> + flags |= LEASE_BREAK_NONBLOCK;
> + if (di && di->di_waited)
> + flags |= LEASE_BREAK_RETRY;
> + ret = break_deleg(inode, flags);
> if (ret == -EWOULDBLOCK && di) {
> di->di_inode = inode;
> ihold(inode);
> @@ -561,6 +567,7 @@ static inline int break_deleg_wait(struct delegated_inode *di)
> iput(inode);
> deactivate_super(sb);
> di->di_inode = NULL;
> + di->di_waited = true;
> return ret;
> }
[Severity: Medium]
Can di_waited apply LEASE_BREAK_RETRY to an unrelated inode in multi-inode
operations?
vfs_rename(), vfs_link(), and vfs_unlink() reuse a single struct
delegated_inode across distinct inodes (for example old_dir, new_dir, source,
and target in vfs_rename()). Once break_deleg_wait() waits on the first
inode and sets di->di_waited = true, the very first try_break_deleg() on the
next inode passes LEASE_BREAK_RETRY and immediately arms
flc_deleg_blocked_until on it.
Even when all holders return their delegations promptly without re-acquiring,
subsequent F_SETDELEG requests on that surviving file or directory then fail
with -EAGAIN for 2 * lease_break_time (90 seconds by default).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204024948.26010-1-dennylin0707@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] filelock: don't hand out a delegation that is being recalled
2026-12-04 2:49 [PATCH v2] filelock: don't hand out a delegation that is being recalled Hungyu Lin
2026-12-04 3:14 ` sashiko-bot
@ 2026-12-04 11:46 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2026-12-04 11:46 UTC (permalink / raw)
To: Hungyu Lin
Cc: cel, alex.aring, viro, brauner, jack, dai.ngo, mjguzik,
zhaogongyi, rostedt, mhiramat, mathieu.desnoyers, linux-fsdevel,
linux-trace-kernel, linux-kernel
On Fri, 2026-12-04 at 02:49 +0000, Hungyu Lin wrote:
> An operation that finds a conflicting delegation gets -EWOULDBLOCK from
> try_break_deleg(), drops its locks, waits in break_deleg_wait() and then
> retries. Nothing stops a new delegation from being set on the inode in
> the meantime.
>
> With F_SETDELEG the owner of a file can do that from userspace: remove
> the delegation when it is recalled and request it again right away. The
> waiter in __break_lease() then finds a delegation that was never asked
> to be returned. It has no break time, so it never times out and its
> holder is not signalled again, and the waiter keeps waiting for it.
>
> As a result unlink(), rename(), chmod() and chown() of the file hang
> until they are interrupted, no matter who calls them and what
> lease-break-time is set to. A delegation on a directory does the same
> to a create in that directory.
>
> When __break_lease() wakes up and still finds a conflicting lease, go
> back and break the ones that were set while it was waiting, the same
> way as the ones it found on entry.
>
> That alone is not enough, because the holder can keep returning the
> delegation and requesting it again. So when a breaker that has already
> waited once finds a new delegation, either on waking up or when its
> caller retries after break_deleg_wait(), stop handing out userland
> delegations on that inode for twice the lease break time. That leaves
> the breaker enough time to get the last one back and to go through.
>
> As long as no delegation is set while one is being recalled, nothing
> changes: a delegation can be requested again as soon as the conflicting
> operation went through. nfsd already keeps track of recalled delegations
> by itself and is left alone.
>
> Fixes: 1602bad16d7d ("vfs: expose delegation support to userland")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> Changes in v2:
> - v1 lifted the block as soon as any non-blocking delegation break found
> nothing left to break. The holder could cause that itself, for example
> with futimens() on the file, and take the delegation again. The block
> is no longer lifted early. Instead it is only set once a breaker has
> to wait a second time.
> - Break the leases that are set while __break_lease() is waiting.
>
> v1: https://lore.kernel.org/all/20261116061502.44674-1-dennylin0707@gmail.com/
>
> fs/locks.c | 21 ++++++++++++++++++---
> include/linux/filelock.h | 9 ++++++++-
> include/trace/events/filelock.h | 3 ++-
> 3 files changed, 28 insertions(+), 5 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 6e4ff7fcec05..2c7af1b7b9c6 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -190,6 +190,7 @@ locks_get_lock_context(struct inode *inode, int type)
> INIT_LIST_HEAD(&ctx->flc_flock);
> INIT_LIST_HEAD(&ctx->flc_posix);
> INIT_LIST_HEAD(&ctx->flc_lease);
> + ctx->flc_deleg_blocked_until = 0;
>
> /*
> * Assign the pointer if it's not already assigned. If it is, then
> @@ -1681,6 +1682,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
> unsigned int type;
> LIST_HEAD(dispose);
> bool want_write = !(flags & LEASE_BREAK_OPEN_RDONLY);
> + bool retry = flags & LEASE_BREAK_RETRY;
> int error = 0;
>
> trace_break_lease(inode, flags);
> @@ -1708,6 +1710,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
> if (!first_visible_lease(inode, new_fl, flags))
> goto out;
>
> +restart:
> break_time = 0;
> if (lease_break_time > 0) {
> break_time = jiffies + lease_break_time * HZ;
> @@ -1731,6 +1734,9 @@ int __break_lease(struct inode *inode, unsigned int flags)
> fl->c.flc_flags |= FL_DOWNGRADE_PENDING;
> fl->fl_downgrade_time = break_time;
> }
> + if (retry && type == FL_DELEG && lease_break_time > 0)
> + ctx->flc_deleg_blocked_until = get_jiffies_64() +
> + 2 * (u64)lease_break_time * HZ;
> if (fl->fl_lmops->lm_break(fl))
> locks_delete_lock_ctx(&fl->c, &dispose);
> }
> @@ -1745,7 +1751,6 @@ int __break_lease(struct inode *inode, unsigned int flags)
> goto out;
> }
>
> -restart:
> break_time = fl->fl_break_time;
> if (break_time != 0) {
> if (time_after(jiffies, break_time)) {
> @@ -1776,9 +1781,10 @@ int __break_lease(struct inode *inode, unsigned int flags)
> */
> if (error == 0)
> time_out_leases(inode, &dispose);
> - fl = first_visible_lease(inode, new_fl, flags);
> - if (fl)
> + if (first_visible_lease(inode, new_fl, flags)) {
> + retry = true;
> goto restart;
> + }
> error = 0;
> }
> out:
> @@ -1968,6 +1974,15 @@ generic_add_lease(struct file *filp, int arg, struct file_lease **flp, void **pr
> if (!leases_enable)
> goto out;
>
> + /*
> + * Don't hand out a new delegation while __break_lease() is having
> + * trouble getting the previous ones returned.
> + */
> + error = -EAGAIN;
> + if (is_deleg && lease->fl_lmops == &lease_manager_ops &&
> + time_before64(get_jiffies_64(), ctx->flc_deleg_blocked_until))
> + goto out;
> +
> locks_insert_lock_ctx(&lease->c, &ctx->flc_lease);
> /*
> * The check in break_lease() is lockless. It's possible for another
> diff --git a/include/linux/filelock.h b/include/linux/filelock.h
> index e909db319067..6b5ec34c9b6e 100644
> --- a/include/linux/filelock.h
> +++ b/include/linux/filelock.h
> @@ -37,6 +37,7 @@
> #define LEASE_BREAK_DIR_CREATE BIT(5) // dir deleg create event
> #define LEASE_BREAK_DIR_DELETE BIT(6) // dir deleg delete event
> #define LEASE_BREAK_DIR_RENAME BIT(7) // dir deleg rename event
> +#define LEASE_BREAK_RETRY BIT(8) // retry after waiting for a break
>
> struct file_lock;
> struct file_lease;
> @@ -158,6 +159,7 @@ struct file_lock_context {
> struct list_head flc_flock;
> struct list_head flc_posix;
> struct list_head flc_lease;
> + u64 flc_deleg_blocked_until;
> };
>
> #ifdef CONFIG_FILE_LOCKING
> @@ -515,6 +517,7 @@ static inline int break_deleg(struct inode *inode, unsigned int flags)
>
> struct delegated_inode {
> struct inode *di_inode;
> + bool di_waited;
> };
>
> static inline bool is_delegated(struct delegated_inode *di)
> @@ -541,7 +544,10 @@ static inline int try_break_deleg(struct inode *inode, unsigned int flags,
> {
> int ret;
>
> - ret = break_deleg(inode, flags | LEASE_BREAK_NONBLOCK);
> + flags |= LEASE_BREAK_NONBLOCK;
> + if (di && di->di_waited)
> + flags |= LEASE_BREAK_RETRY;
> + ret = break_deleg(inode, flags);
> if (ret == -EWOULDBLOCK && di) {
> di->di_inode = inode;
> ihold(inode);
> @@ -561,6 +567,7 @@ static inline int break_deleg_wait(struct delegated_inode *di)
> iput(inode);
> deactivate_super(sb);
> di->di_inode = NULL;
> + di->di_waited = true;
> return ret;
> }
>
> diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
> index f11284be01ea..02b0f0687afc 100644
> --- a/include/trace/events/filelock.h
> +++ b/include/trace/events/filelock.h
> @@ -129,7 +129,8 @@ DEFINE_EVENT(filelock_lock, flock_lock_inode,
> { LEASE_BREAK_OPEN_RDONLY, "OPEN_RDONLY" }, \
> { LEASE_BREAK_DIR_CREATE, "DIR_CREATE" }, \
> { LEASE_BREAK_DIR_DELETE, "DIR_DELETE" }, \
> - { LEASE_BREAK_DIR_RENAME, "DIR_RENAME" })
> + { LEASE_BREAK_DIR_RENAME, "DIR_RENAME" }, \
> + { LEASE_BREAK_RETRY, "RETRY" })
>
> TRACE_EVENT(break_lease,
> TP_PROTO(struct inode *inode, unsigned int flags),
>
> base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
I'm not sure I like plumbing this logic into file locking layer. We've
never made this guarantee at this level. In nfsd this is handled by
higher-level logic it has a bloom filter that prevents delegs from
being handed out too quickly after recall.
I'll ponder this, but for the moment I don't see a compelling reason to
do this here.
Thanks,
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-04 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 2:49 [PATCH v2] filelock: don't hand out a delegation that is being recalled Hungyu Lin
2026-12-04 3:14 ` sashiko-bot
2026-12-04 11:46 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox