Bug 1789679 - glusterfs behave differently from nfs in case of bind mount
Summary: glusterfs behave differently from nfs in case of bind mount
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: GlusterFS
Classification: Community
Component: fuse
Version: 7
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-10 05:39 UTC by zhou lin
Modified: 2020-03-12 12:19 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-12 12:19:40 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description zhou lin 2020-01-10 05:39:59 UTC
Description of problem:
remove bind mount source file and then visit bind mount target file, bind mount target file return stale file handle. this behaviour is different from nfs, is this a bug or glusterfs is designed to be like this?

Version-Release number of selected component (if applicable):
glusterfs7.0

How reproducible:


Steps to Reproduce:
1.touch a b write some content to file a and b
2.mount --bind a b
3.rm a
4.cat b will show stale file handle

Actual results:
cat b return "Stale file handle"

Expected results:
cat b could show content of file a


/////////////////glusterfs log/////////////////
[root@mn-0:/mnt/mstate]
# touch testa testb
[root@mn-0:/mnt/mstate]
# echo "testa">testa
[root@mn-0:/mnt/mstate]
# echo "testb">testb
[root@mn-0:/mnt/mstate]
# stat testa testb
  File: testa
  Size: 6               Blocks: 1          IO Block: 131072 regular file
Device: 2ch/44d Inode: 10882777708173043205  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-10 07:27:27.158101292 +0200
Modify: 2020-01-10 07:27:31.359540858 +0200
Change: 2020-01-10 07:27:31.359540858 +0200
 Birth: -
  File: testb
  Size: 6               Blocks: 1          IO Block: 131072 regular file
Device: 2ch/44d Inode: 9880227614551106819  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-10 07:27:27.168101297 +0200
Modify: 2020-01-10 07:27:35.848930005 +0200
Change: 2020-01-10 07:27:35.848930005 +0200
 Birth: -
[root@mn-0:/mnt/mstate]
# mount --bind testa testb
[root@mn-0:/mnt/mstate]
# stat testa testb
  File: testa
  Size: 6               Blocks: 1          IO Block: 131072 regular file
Device: 2ch/44d Inode: 10882777708173043205  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-10 07:27:27.158101292 +0200
Modify: 2020-01-10 07:27:31.359540858 +0200
Change: 2020-01-10 07:27:31.359540858 +0200
 Birth: -
  File: testb
  Size: 6               Blocks: 1          IO Block: 131072 regular file
Device: 2ch/44d Inode: 10882777708173043205  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-10 07:27:27.158101292 +0200
Modify: 2020-01-10 07:27:31.359540858 +0200
Change: 2020-01-10 07:27:31.359540858 +0200
 Birth: -
[root@mn-0:/mnt/mstate]
# rm testa
[root@mn-0:/mnt/mstate]
# cat testb
cat: testb: Stale file handle
[root@mn-0:/mnt/mstate]
# stat testa testb
stat: cannot stat 'testa': No such file or directory
stat: cannot stat 'testb': Stale file handle
[root@mn-0:/mnt/mstate]

/////////////////////////nfs log/////////////////////

Additional info:
for nfs:
[root@as-0:/mnt/export]
# touch aaaa bbbb
[root@as-0:/mnt/export]
# echo "testa">aaaa
[root@as-0:/mnt/export]
# echo "testb">bbbb
[root@as-0:/mnt/export]
# mount --bind aaaa bbbb
[root@as-0:/mnt/export]
# stat aaaa bbbb
  File: aaaa
  Size: 6               Blocks: 8          IO Block: 524288 regular file
Device: 27h/39d Inode: 18          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (  615/_nokfsuifileshare)
Access: 2020-01-10 11:18:32.610946394 +0800
Modify: 2020-01-10 11:18:38.179982981 +0800
Change: 2020-01-10 11:18:38.179982981 +0800
 Birth: -
  File: bbbb
  Size: 6               Blocks: 8          IO Block: 524288 regular file
Device: 27h/39d Inode: 18          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (  615/_nokfsuifileshare)
Access: 2020-01-10 11:18:32.610946394 +0800
Modify: 2020-01-10 11:18:38.179982981 +0800
Change: 2020-01-10 11:18:38.179982981 +0800
 Birth: -
[root@as-0:/mnt/export]
# rm aaaa
[root@as-0:/mnt/export]
# stat aaaa bbbb
stat: cannot stat 'aaaa': No such file or directory
  File: bbbb
  Size: 6               Blocks: 8          IO Block: 524288 regular file
Device: 27h/39d Inode: 18          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (  615/_nokfsuifileshare)
Access: 2020-01-10 11:18:32.610946394 +0800
Modify: 2020-01-10 11:18:38.179982981 +0800
Change: 2020-01-10 11:19:06.350160327 +0800
 Birth: -
[root@as-0:/mnt/export]
# cat aaaa bbbb
cat: aaaa: No such file or directory
testa


Analysis:
for glusterfs rm a will really remove a from brick even when file b is bind mount to a, but from nfs side, when remove a there are still b

Comment 1 Worker Ant 2020-03-12 12:19:40 UTC
This bug is moved to https://github.com/gluster/glusterfs/issues/872, and will be tracked there from now on. Visit GitHub issues URL for further details


Note You need to log in before you can comment on or make changes to this bug.