]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: fix CIL sparse lock context warnings
authorDave Chinner <dchinner@redhat.com>
Tue, 2 Apr 2024 21:28:28 +0000 (08:28 +1100)
committerChandan Babu R <chandanbabu@kernel.org>
Sat, 20 Apr 2024 14:53:59 +0000 (20:23 +0530)
Sparse reports:

fs/xfs/xfs_log_cil.c:1127:1: warning: context imbalance in 'xlog_cil_push_work' - different lock contexts for basic block
fs/xfs/xfs_log_cil.c:1380:1: warning: context imbalance in 'xlog_cil_push_background' - wrong count at exit
fs/xfs/xfs_log_cil.c:1623:9: warning: context imbalance in 'xlog_cil_commit' - unexpected unlock

xlog_cil_push_background() has a locking annotations for an rw_sem.
Sparse does not track lock contexts for rw_sems, so the
annotation generates false warnings. Remove the annotation.

xlog_wait_on_iclog() drops the log->l_ic_loglock. The function has a
sparse annotation, but the prototype in xfs_log_priv.h does not.
Hence the warning from xlog_cil_push_work() which calls
xlog_wait_on_iclog(). Add the missing annotation.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/xfs_log_cil.c
fs/xfs/xfs_log_priv.h

index 73f5b7f628f4fe67a9566a9c648fcd371fad4b05..f51cbc6405c15a97f96cd6b2e9dbce57f2eb645b 100644 (file)
@@ -1378,7 +1378,7 @@ out_abort_free_ticket:
  */
 static void
 xlog_cil_push_background(
-       struct xlog     *log) __releases(cil->xc_ctx_lock)
+       struct xlog     *log)
 {
        struct xfs_cil  *cil = log->l_cilp;
        int             space_used = atomic_read(&cil->xc_ctx->space_used);
index 43881575cd498fe1a9c0a71f787fe6fd4c974e2e..a78c4bfaad447434207d6b4ff306a9bcfd6f8868 100644 (file)
@@ -620,7 +620,8 @@ xlog_wait(
        remove_wait_queue(wq, &wait);
 }
 
-int xlog_wait_on_iclog(struct xlog_in_core *iclog);
+int xlog_wait_on_iclog(struct xlog_in_core *iclog)
+               __releases(iclog->ic_log->l_icloglock);
 
 /*
  * The LSN is valid so long as it is behind the current LSN. If it isn't, this