[lustre-devel] [PATCH 17/21] lustre: obdclass: result of try_module_get() should not be ignored.
NeilBrown
neilb at suse.com
Wed Feb 6 16:03:33 PST 2019
If try_module_get() fails, the open must fail.
In practice this should be impossible, but it is
best to make the code look right.
Signed-off-by: NeilBrown <neilb at suse.com>
---
drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 48d1dabafa65..982d47b6f50e 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -548,8 +548,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
/* opening /dev/obd */
static int obd_class_open(struct inode *inode, struct file *file)
{
- try_module_get(THIS_MODULE);
- return 0;
+ return try_module_get(THIS_MODULE) ? 0 : -ENODEV;
}
/* closing /dev/obd */
More information about the lustre-devel
mailing list