Fix error reporting for already mounted shares.
Subsystems (2)
PATCH 1/1 Fix error reporting for already mounted shares.
When mount is triggered for an already mounted share (using auto negotiation), it displays "mount.nfs: Protocol not supported" or "mount.nfs: access denied by server while mounting" instead of EBUSY. This easily causes confusion if the mount was not tried verbose :
[root@rsable ~]# mount 127.0.0.1:/export /mnt
mount.nfs: Protocol not supported
[root@rsable ~]# mount -v 127.0.0.1:/export /mnt
mount.nfs: timeout set for Mon Apr 5 16:03:53 2021
mount.nfs: trying text-based options 'vers=4.2,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=127.0.0.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 127.0.0.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 127.0.0.1 prog 100005 vers 3 prot UDP port 20048
mount.nfs: mount(2): Device or resource busy << actual error
mount.nfs: Protocol not supported
[root@rsable ~]# mount rsable76server:/testshare /mnt mount.nfs: access denied by server while mounting rsable76server:/testshare
[root@rsable ~]# mount rsable76server:/testshare /mnt -v
mount.nfs: timeout set for Mon Jan 17 13:36:16 2022
mount.nfs: trying text-based options 'vers=4.1,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied
mount.nfs: trying text-based options 'vers=4.0,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied
mount.nfs: trying text-based options 'addr=192.168.122.58'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.122.58 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.122.58 prog 100005 vers 3 prot UDP port 20048
mount.nfs: mount(2): Device or resource busy << actual error
mount.nfs: access denied by server while mounting rsable76server:/testshare
--- utils/mount/stropts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
utils/mount/stropts.c +3 -1
@@ -973,7 +973,9 @@ fall_back:if ((result =nfs_try_mount_v3v2 (mi, FALSE)))return result; - errno = olderrno; +if (errno !=EBUSY || errno !=EACCES ) + errno = olderrno; +return result; }
Signature · 1 line
2.34.1
Quoted 43 lines · Rohan Sable
When mount is triggered for an already mounted share (using auto negotiation), it displays "mount.nfs: Protocol not supported" or "mount.nfs: access denied by server while mounting" instead of EBUSY. This easily causes confusion if the mount was not tried verbose :
[root@rsable ~]# mount 127.0.0.1:/export /mnt
mount.nfs: Protocol not supported[root@rsable ~]# mount -v 127.0.0.1:/export /mnt
mount.nfs: timeout set for Mon Apr 5 16:03:53 2021
mount.nfs: trying text-based options 'vers=4.2,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=127.0.0.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 127.0.0.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 127.0.0.1 prog 100005 vers 3 prot UDP port 20048
mount.nfs: mount(2): Device or resource busy << actual error
mount.nfs: Protocol not supported[root@rsable ~]# mount rsable76server:/testshare /mnt mount.nfs: access denied by server while mounting rsable76server:/testshare
[root@rsable ~]# mount rsable76server:/testshare /mnt -v
mount.nfs: timeout set for Mon Jan 17 13:36:16 2022
mount.nfs: trying text-based options 'vers=4.1,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied
mount.nfs: trying text-based options 'vers=4.0,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied
mount.nfs: trying text-based options 'addr=192.168.122.58'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.122.58 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.122.58 prog 100005 vers 3 prot UDP port 20048
mount.nfs: mount(2): Device or resource busy << actual error
mount.nfs: access denied by server while mounting rsable76server:/testshare
Quoted 2 lines
Signed-off-by Rohan Sable <[email protected]>Signed-off-by Yongcheng Yang <[email protected]>
Committed...
steved.
Quoted 19 lines
--- utils/mount/stropts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)utils/mount/stropts.c +3
-1@@ -973,7 +973,9 @@ fall_back:if ((result =nfs_try_mount_v3v2 (mi, FALSE)))return result; - errno = olderrno; +if (errno !=EBUSY || errno !=EACCES ) + errno = olderrno; +return result; }