diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-16 06:23:06 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-17 02:20:00 -0500 |
commit | f76e97e4ef2ef12027087a17dac89b3438730a6c (patch) | |
tree | 80604cd4f367447302aa2da5f8c722665db16aae | |
parent | b53f7a1846143b48dd4b6704c65e97d2628729fb (diff) |
bcachefs: Change bch2_dev_lookup() to not use lookup_bdev()
bch2_dev_lookup() is used from the extended attribute set methods, for
setting the target options, where we're already holding an inode lock -
it turns out pathname lookups also take inode locks, so that was
susceptible to deadlocks.
Fortunately we already stash the device name in ca->name. This does
change user-visible behaviour though: instead of specifying e.g.
/dev/sda1, user must now specify sda1.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/super.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index e6eff26fc0c8..b36e6216a8a1 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1880,20 +1880,14 @@ err: } /* return with ref on ca->ref: */ -struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *path) +struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *name) { struct bch_dev *ca; - dev_t dev; unsigned i; - int ret; - - ret = lookup_bdev(path, &dev); - if (ret) - return ERR_PTR(ret); rcu_read_lock(); for_each_member_device_rcu(ca, c, i, NULL) - if (ca->dev == dev) + if (!strcmp(name, ca->name)) goto found; ca = ERR_PTR(-ENOENT); found: |