Bug 765564 (GLUSTER-3832)

Summary: afr_rename, afr_rmdir don't acquire (all) the necessary entrylks.
Product: [Community] GlusterFS Reporter: krishnan parthasarathi <kparthas>
Component: replicateAssignee: krishnan parthasarathi <kparthas>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: pre-releaseCC: amarts, gluster-bugs, nsathyan, rfortier
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: glusterfs-3.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-24 17:33:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description krishnan parthasarathi 2011-11-29 05:33:03 UTC
Afr needs to acquire the following entry locks (on all replica subvols) when,

- "rmdir (pathname=dirname/basename)" is issued on a replicated volume.

   entrylk (dirname, basename) and entrylk (pathname, NULL) in that order. 

- "rename (src=sdirname/sbasename, dst=ddirname/dbasename)" is issued on a replicated volume. Note: here dst is a directory.

   entrylk (sdirname, sbasename), entrylk (ddirname, dbasename) in a deterministic order.
   Subsequently an entrylk (dst, NULL) - To ensure 'dst' remains empty all through the rename operation.

Comment 1 Rahul C S 2012-01-06 08:35:24 UTC
Saw the issue happening at this head: 5303f98f674ab5cb600dde0394ff7ddd5ba3c98a
for a distributed-replicate volume with 6 bricks[3x2]
Steps:
1. untarred openssl & did ./config && make && make test on the mount point
2. did replace brick from 1 brick to a fresh brick.
3. While the replace brick was migrating the openssl directory, did an rm -rf on the openssl directory.

Result:
rm failed saying that openssl/apps & openssl/crypto is not empty.
From the mountpoint, the files inside those directories were empty, but at the backend, the destination brick after the migrate brick operation, has a file each in both the directories, which have gfid.

But its still not visible from the mountpoint & hence rm fails on the  directories.

Comment 2 Amar Tumballi 2012-10-23 18:33:35 UTC
http://review.gluster.org/2828 posted for review

Comment 3 Vijay Bellur 2013-01-23 17:17:14 UTC
CHANGE: http://review.gluster.org/2828 (afr: Modified book-keeping structures for entrylks) merged in master by Anand Avati (avati)

Comment 4 Vijay Bellur 2013-01-26 08:20:17 UTC
CHANGE: http://review.gluster.org/4433 (replicate: fix lock counting in blocking lock path) merged in master by Anand Avati (avati)

Comment 5 Vijay Bellur 2013-01-28 08:21:59 UTC
CHANGE: http://review.gluster.org/4436 (cluster/afr: before checking lock_count of internal lock make sure its not              entrylk) merged in master by Anand Avati (avati)

Comment 6 Vijay Bellur 2013-01-28 21:50:21 UTC
CHANGE: http://review.gluster.org/4442 (bug-765564.t: fix path for file to rename) merged in master by Anand Avati (avati)

Comment 7 Vijay Bellur 2013-01-29 20:51:09 UTC
CHANGE: http://review.gluster.org/4438 (cluster/afr: if a subvolume is down wind the lock request to next) merged in master by Anand Avati (avati)

Comment 8 Vijay Bellur 2013-02-07 19:09:50 UTC
CHANGE: http://review.gluster.org/4480 (afr: serialize modification of {entrylk,inodelk}_lock_count) merged in master by Anand Avati (avati)