register_filesystem() must return -EEXIST if the filesystem with the same name is already registered
PATCH 1/1 register_filesystem() must return -EEXIST if the filesystem with the same name is already registered
If we have a look at the register_filesystem() function defined in fs/filesystems.c, we see that if a filesystem with a same name has already been registered then the find_filesystem() function will return NON-NULL otherwise it will return NULL.
Hence, register_filesystem() should return EEXIST instead of EBUSY. Returning EBUSY is misleading (unless of course I'm missing something obvious) to the caller of register_filesystem().
Thanks,
Hareesh Nagarajan
fs/filesystems.c +1 -1
@@ -76,7 +76,7 @@write_lock (&file_systems_lock); p =find_filesystem (fs->name);if (*p) - res = -EBUSY ; + res = -EEXIST ;else *p = fs;write_unlock (&file_systems_lock);
Quoted 8 lines · Hareesh Nagarajan
If we have a look at the
register_filesystem()function defined infs/filesystems.c, we see that if a filesystem with a same name has already been registered then thefind_filesystem()function will return NON-NULL otherwise it will return NULL.Hence,
register_filesystem()should return EEXIST instead of EBUSY. Returning EBUSY is misleading (unless of course I'm missing something obvious) to the caller ofregister_filesystem().
This `slot' is buy, so EBUSY makes sense. Filesytem is not file, hence EEXIST doesn't apply IMHO.
Coywolf
Quoted 17 lines
Thanks,
Hareesh Nagarajan
fs/filesystems.c +1
-1@@ -76,7 +76,7 @@write_lock (&file_systems_lock); p =find_filesystem (fs->name);if (*p) - res = -EBUSY ; + res = -EEXIST ;else *p = fs;write_unlock (&file_systems_lock);
Quoted 11 lines · Coywolf Qi Hunt
Quoted 8 lines · Hareesh Nagarajan
If we have a look at the
register_filesystem()function defined infs/filesystems.c, we see that if a filesystem with a same name has already been registered then thefind_filesystem()function will return NON-NULL otherwise it will return NULL.Hence,
register_filesystem()should return EEXIST instead of EBUSY. Returning EBUSY is misleading (unless of course I'm missing something obvious) to the caller ofregister_filesystem().This `slot' is buy, so EBUSY makes sense. Filesytem is not file, hence
s/buy/busy/
Quoted 21 lines
EEXIST doesn't apply IMHO.
Coywolf
Quoted 17 lines
Thanks,
Hareesh Nagarajan
fs/filesystems.c +1
-1@@ -76,7 +76,7 @@write_lock (&file_systems_lock); p =find_filesystem (fs->name);if (*p) - res = -EBUSY ; + res = -EEXIST ;else *p = fs;write_unlock (&file_systems_lock);
Quoted 7 lines · Coywolf Qi Hunt
Quoted 3 lines · Hareesh Nagarajan
If we have a look at the
register_filesystem()function defined infs/filesystems.c, we see that if a filesystem with a same name has already been registered then thefind_filesystem()function will return NON-NULL otherwise it will return NULL.Hence,
register_filesystem()should return EEXIST instead of EBUSY. Returning EBUSY is misleading (unless of course I'm missing something obvious) to the caller ofregister_filesystem().This `slot' is buy, so EBUSY makes sense. Filesytem is not file, hence EEXIST doesn't apply IMHO.
Earlier this week, my calls to register_filesystem(struct file_system_type * fs) were failing returning an -EBUSY. Now I didn't know if it was failing because of:
if (fs->next) return -EBUSY;
Or:
p = find_filesystem(fs->name);
if (*p) res = -EBUSY;
...
return res;It is for this reason I thought it would make sense to differentiate between the two points of failure.
Hareesh Nagarajan