nfs: return -EBUSY on remount when new options can't be applied
Subsystems (2)
PATCH 1/1 nfs: return -EBUSY on remount when new options can't be applied
Currently the kernel returns -EINVAL, which makes it hard to distinguish this situation from the case where an invalid mount option was specified.
--- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/super.c +1 -1
@@ -2156,7 +2156,7 @@ nfs_compare_remount_data(struct nfs_server *nfss, data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || !rpc_cmp_addr ((struct sockaddr *)&data->nfs_server.address, (struct sockaddr *)&nfss->nfs_client->cl_addr)) - return -EINVAL; + return -EBUSY;return 0 ; }
Signature · 1 line
1.8.3.1
Quoted 14 lines · Jeff Layton
Currently the kernel returns
-EINVAL, which makes it hard to distinguish this situation from the case where an invalid mount option was specified.Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/super.c | 2 +-- 1 file changed, 1 insertion(+-), 1 deletion(-)fs/nfs/super.c +1
-1--- a/fs/nfs/super.c +-+-+- b/fs/nfs/super.c@@ -2156,7 +-2156,7 @@ nfs_compare_remount_data(struct
nfs_server*nfss,
fs/nfs/super.c nfs_compare_remount_data(struct nfs_server *nfss, · line 2162
Quoted 8 lines
fs/nfs/super.c +1
-1data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || !rpc_cmp_addr ((struct sockaddr *)&data->nfs_server.address, (struct sockaddr *)&nfss->nfs_client->cl_addr)) - return -EINVAL; +- return -EBUSY ;return 0 ; }
The problem is that EBUSY also has a different meaning when it comes to remount. According to the manpage it means the source "cannot be remounted read-only, because it still holds files open for writing."
So, as far as I can see, this is a case of pick your poison...
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Quoted 21 lines · Trond
Quoted 20 lines · Jeff Layton
Currently the kernel returns
-EINVAL, which makes it hard to distinguish this situation from the case where an invalid mount option was specified.Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfs/super.c +1
-1@@ -2156,7 +2156,7 @@ nfs_compare_remount_data(struct nfs_server *nfss, data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || !rpc_cmp_addr ((struct sockaddr *)&data->nfs_server.address, (struct sockaddr *)&nfss->nfs_client->cl_addr)) - return -EINVAL; + return -EBUSY;
Quoted 9 lines
fs/nfs/super.c nfs_compare_remount_data(struct nfs_server *nfss, · line 2162
Quoted 2 lines
fs/nfs/super.c +0
-0return 0 ; }The problem is that EBUSY also has a different meaning when it comes to remount. According to the manpage it means the source "cannot be remounted read-only, because it still holds files open for writing."
So, as far as I can see, this is a case of pick your poison...
Yes, there is no great return code for this, sadly. The same manpage says this for -EINVAL, which isn't exactly correct either:
"Or, a remount (MS_REMOUNT) was attempted, but source was not already mounted on target."
-EBUSY certainly isn't perfect but it does seem a little closer to the mark, IMO. That said, I don't feel terribly strongly about it if you think we ought to keep it as-is.
Signature · 1 line
Jeff Layton <[email protected]>