mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 15:43:08 -04:00
rnbd: use scoped_with_init_fs() for block device open
Use scoped_with_init_fs() to temporarily override current->fs for the bdev_file_open_by_path() call so the path lookup happens in init's filesystem context. process_msg_open() ← rnbd_srv_rdma_ev() ← RDMA completion callback ← ib_cq_poll_work() ← kworker (InfiniBand completion workqueue) Link: https://patch.msgid.link/20260601-work-kthread-nullfs-v4-6-77ee053060e0@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/fs_struct.h>
|
||||
|
||||
#include "rnbd-srv.h"
|
||||
#include "rnbd-srv-trace.h"
|
||||
@@ -734,7 +735,8 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,
|
||||
goto reject;
|
||||
}
|
||||
|
||||
bdev_file = bdev_file_open_by_path(full_path, open_flags, NULL, NULL);
|
||||
scoped_with_init_fs()
|
||||
bdev_file = bdev_file_open_by_path(full_path, open_flags, NULL, NULL);
|
||||
if (IS_ERR(bdev_file)) {
|
||||
ret = PTR_ERR(bdev_file);
|
||||
pr_err("Opening device '%s' on session %s failed, failed to open the block device, err: %pe\n",
|
||||
|
||||
Reference in New Issue
Block a user