Bug 1782428

Summary: Unlinking the file with open fd, is leading to unexpected behavior with sharding enabled
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: SATHEESARAN <sasundar>
Component: shardingAssignee: Vinayak Hariharmath <vharihar>
Status: CLOSED ERRATA QA Contact: SATHEESARAN <sasundar>
Severity: high Docs Contact:
Priority: high    
Version: rhgs-3.5CC: jahernan, pprakash, rhs-bugs, sheggodu, spamecha, vharihar
Target Milestone: ---Keywords: ZStream
Target Release: RHGS 3.5.z Batch Update 7   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: glusterfs-6.0-57 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-05 07:56:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description SATHEESARAN 2019-12-11 15:57:29 UTC
Description of problem:
------------------------
Unlinking the file with open fd is leading to the unxpected failure

Version-Release number of selected component (if applicable):
---------------------------------------------------------------
RHGS 3.5.0 ( glusterfs-6.0-24.el7rhgs )

How reproducible:
------------------
always

Steps to Reproduce:
-------------------
1. Run the script ( attached ), that open fd, unlinks file, tries to use that same fd

Actual results:
---------------
Failure

Expected results:
------------------
All should work successfully

Comment 1 Krutika Dhananjay 2019-12-12 06:00:34 UTC
Satheesaran,
Could you attach the script to the bz?

-Krutika

Comment 2 SATHEESARAN 2019-12-17 05:34:00 UTC
(In reply to Krutika Dhananjay from comment #1)
> Satheesaran,
> Could you attach the script to the bz?
> 
> -Krutika

import mmap
import os
import stat
#import time

path = "/rhev/data-center/mnt/glusterSD/rhsqa-grafton10.lab.eng.blr.redhat.com:_engine/.probe_test" <<< This is the fuse mount path
f = os.open(path, os.O_WRONLY | os.O_DIRECT | os.O_DSYNC | os.O_CREAT | os.O_EXCL, stat.S_IRUSR | stat.S_IWUSR)
#time.sleep(20)
os.unlink(path)

#time.sleep(20)
m = mmap.mmap(-1, 1024)
s = b' ' * 1024

m.write(s)
os.write(f, m)
os.close(f)

Comment 22 SATHEESARAN 2021-07-21 13:35:30 UTC
Verified with glusterfs-6.0-59.el8rhgs with the following steps:

1. Created a c program ( process1) that opens the fd on the file and waits indefinitely
2. Created yet another C program  that unlinks the file
3. There are no errors seen with process1 and completes successfully
4. Also the python script as per comment2 also worked without any error

Comment 24 errata-xmlrpc 2021-10-05 07:56:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (RHGS 3.5.z Batch Update 5 glusterfs bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:3729