netfs: Use bh-disabling spinlocks for rreq->lock
authorDavid Howells <dhowells@redhat.com>
Fri, 12 Jul 2024 10:54:11 +0000 (11:54 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 5 Sep 2024 09:00:42 +0000 (11:00 +0200)
Use bh-disabling spinlocks when accessing rreq->lock because, in the
future, it may be twiddled from softirq context when cleanup is driven from
cache backend DIO completion.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20240814203850.2240469-12-dhowells@redhat.com/
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/netfs/write_collect.c
fs/netfs/write_issue.c

index 90abc21cc019f77d4d05813c2cfc6e4c8824635c..9a1b408d614ccf96c6e87e66afa76f6e102e9831 100644 (file)
@@ -473,7 +473,7 @@ reassess_streams:
 
                cancel:
                        /* Remove if completely consumed. */
-                       spin_lock(&wreq->lock);
+                       spin_lock_bh(&wreq->lock);
 
                        remove = front;
                        list_del_init(&front->rreq_link);
@@ -489,7 +489,7 @@ reassess_streams:
                                }
                        }
 
-                       spin_unlock(&wreq->lock);
+                       spin_unlock_bh(&wreq->lock);
                        netfs_put_subrequest(remove, false,
                                             notes & SAW_FAILURE ?
                                             netfs_sreq_trace_put_cancel :
index 41db709ca1d34430bc5aa13625f2cfaca2f34c0b..7880a586343f5ee0874f7a1418e765fbca12e010 100644 (file)
@@ -191,7 +191,7 @@ static void netfs_prepare_write(struct netfs_io_request *wreq,
         * the list.  The collector only goes nextwards and uses the lock to
         * remove entries off of the front.
         */
-       spin_lock(&wreq->lock);
+       spin_lock_bh(&wreq->lock);
        list_add_tail(&subreq->rreq_link, &stream->subrequests);
        if (list_is_first(&subreq->rreq_link, &stream->subrequests)) {
                stream->front = subreq;
@@ -202,7 +202,7 @@ static void netfs_prepare_write(struct netfs_io_request *wreq,
                }
        }
 
-       spin_unlock(&wreq->lock);
+       spin_unlock_bh(&wreq->lock);
 
        stream->construct = subreq;
 }