mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-06 04:19:23 -04:00
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>
This commit is contained in:
committed by
Kent Overstreet
parent
2232fa397c
commit
bf7e49a4ae
@@ -1883,20 +1883,14 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets)
|
||||
}
|
||||
|
||||
/* 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:
|
||||
|
||||
Reference in New Issue
Block a user