fs:Fix error handling in the function time_out_leases
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · On Thu, 23 Jul 2015 22:57:57 -0400 Nicholas Krause <[email protected]> wrote:
This fixes error handling in the function
time_out_leasesby checking if the call to the functionlease_modifyfailed in both if statements in this function by checking its return value for a error code and if so print to the console that modifying the file lock's lease has failed on the inode pointer argument befor returning immediately to this function's caller as we cannot continue here.Signed-off-by Nicholas Krause <[email protected]>--- fs/locks.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)fs/locks.c +0
-0
fs/locks.c static void time_out_leases(struct inode *inode, struct list_head *dispose) · line 1347
Quoted 7 lines
fs/locks.c +0
-4@@ -1341,10 +1341,18 @@ static void time_out_leases(struct inode *inode, struct list_head *dispose)list_for_each_entry_safe (fl, tmp, &ctx->flc_lease, fl_list) {trace_time_out_leases (inode, fl); -if (past_time (fl->fl_downgrade_time)) -lease_modify (fl,F_RDLCK , dispose); -if (past_time (fl->fl_break_time)) -lease_modify (fl,F_UNLCK , dispose);
lease_modify will only fail if the "arg" that it's passed is bogus, and that's clearly not the case in these callers. What might be better is to make a lease_modify variant that's a void return and that throws a WARN when "arg" is bad.
I'd suggest just making lease_modify itself a void return, but it's also the stock lm_change callback, and that prototype requires an int return function.
fs/locks.c static void time_out_leases(struct inode *inode, struct list_head *dispose) · line 1346
Quoted 3 lines
fs/locks.c +3
-0+if (past_time (fl->fl_downgrade_time)) { +if (lease_modify (fl,F_RDLCK , dispose)) { +pr_err ("Unable to modify lease on %p\n file lock\n" , fl);
A couple of nits here: printing out the pointer value won't generally be helpful in an ERR level log message. Also, there's no need to embed a newline in the middle of the message. That can make for an ugly log message in syslog or the equivalent.
Quoted 13 lines
fs/locks.c +9
-0+return ; + } + } +if (past_time (fl->fl_break_time)) { +if (lease_modify (fl,F_UNLCK , dispose)) { + pr_err("Unable to modify lease on %p\n file lock\n", fl); + return; + } + } } }
Signature · 1 line
Jeff Layton <[email protected]>