From a3d7afa5c1b62140168982747fd15c1999d991f4 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 18 Jun 2022 19:55:32 -0400 Subject: bcachefs: Always use percpu_ref_tryget_live() on c->writes If we're trying to get a ref and the refcount has been killed, it means we're doing an emergency shutdown - we always want tryget_live(). Signed-off-by: Kent Overstreet --- fs/bcachefs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/sysfs.c') diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 173289c34de0..4e2b6285cf3a 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -676,7 +676,7 @@ STORE(bch2_fs_opts_dir) * We don't need to take c->writes for correctness, but it eliminates an * unsightly error message in the dmesg log when we're RO: */ - if (unlikely(!percpu_ref_tryget(&c->writes))) + if (unlikely(!percpu_ref_tryget_live(&c->writes))) return -EROFS; tmp = kstrdup(buf, GFP_KERNEL); -- cgit