Description of problem: was_dir in not initialized to 0 so even when the path is file victim gfid handle is unset. victim gfid handle should be unset when nlink is 1 not 2.
CHANGE: http://review.gluster.com/2698 (storage/posix: Fix rename gfid handle unset) merged in master by Anand Avati (avati)
Checked with glusterfs-3.3.0qa45 and now when mv b a is done, that the gfid handle related to a is unset and the gfid based backend does not contain the handle related to a's gfid. mnt/sda7/export3/b trusted.gfid=0xfc76b58cecd44d5aaa1a159e01bbd8cf trusted.glusterfs.3382aaa7-37d0-4fab-bd3c-dc9a7a350acf.xtime=0x4fcc887c0002467d trusted.glusterfs.quota.00000000-0000-0000-0000-000000000001.contri=0x0000000000000000 root@hyperspace:/mnt/client# ls /mnt/sda7/export3/.glusterfs/e8/64/ e864fd84-f7c8-4751-8520-f4153d94ad0b root@hyperspace:/mnt/client# stat /mnt/sda7/export3/.glusterfs/e8/64/ File: `/mnt/sda7/export3/.glusterfs/e8/64/' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 807h/2055d Inode: 3204225 Links: 2 Access: (0700/drwx------) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2012-06-04 15:36:23.301187300 +0530 Modify: 2012-06-04 15:35:46.681187294 +0530 Change: 2012-06-04 15:35:46.681187294 +0530 root@hyperspace:/mnt/client# stat /mnt/sda7/export3/.glusterfs/fc/76/fc76b58c-ecd4-4d5a-aa1a-159e01bbd8cf File: `/mnt/sda7/export3/.glusterfs/fc/76/fc76b58c-ecd4-4d5a-aa1a-159e01bbd8cf' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 807h/2055d Inode: 2883655 Links: 2 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2012-06-04 15:35:48.000000000 +0530 Modify: 2012-06-04 15:35:48.000000000 +0530 Change: 2012-06-04 15:35:48.141187294 +0530 root@hyperspace:/mnt/client# root@hyperspace:/mnt/client# ls a b root@hyperspace:/mnt/client# mv b a root@hyperspace:/mnt/client# ls a root@hyperspace:/mnt/client# getfattr -d -m . -e hex /mnt/sda7/export3/a getfattr: Removing leading '/' from absolute path names # file: mnt/sda7/export3/a trusted.gfid=0xfc76b58cecd44d5aaa1a159e01bbd8cf trusted.glusterfs.3382aaa7-37d0-4fab-bd3c-dc9a7a350acf.xtime=0x4fcc88b700007a9b root@hyperspace:/mnt/client# stat /mnt/sda7/export3/.glusterfs/e8/64/ File: `/mnt/sda7/export3/.glusterfs/e8/64/' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 807h/2055d Inode: 3204225 Links: 2 Access: (0700/drwx------) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2012-06-04 15:36:23.301187300 +0530 Modify: 2012-06-04 15:36:47.021187302 +0530 Change: 2012-06-04 15:36:47.021187302 +0530 root@hyperspace:/mnt/client# ls /mnt/sda7/export3/.glusterfs/e8/64/ root@hyperspace:/mnt/client#