From cb884f7eac134866ca47701d3208055acecbf9a0 Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Fri, 2 Nov 2012 16:09:13 +0530 Subject: nfs: do not change root inode if enable-ino32 is set When a user sets nfs.enable-ino32 on, the root inode, which must be 1, is jumbled during hashing of the gfid into 32 bits. This patch avoids doing that, and returns inode of 1 for the root inode. Change-Id: Ib65f2660998a95e1059be32bc298485c5cbe52df BUG: 864222 Signed-off-by: Rajesh Amaravathi Reviewed-on: http://review.gluster.org/4154 Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-864222.t | 26 ++++++++++++++++++++++++++ xlators/nfs/server/src/nfs-common.c | 3 +++ 2 files changed, 29 insertions(+) create mode 100755 tests/bugs/bug-864222.t diff --git a/tests/bugs/bug-864222.t b/tests/bugs/bug-864222.t new file mode 100755 index 00000000000..6e02ab60bca --- /dev/null +++ b/tests/bugs/bug-864222.t @@ -0,0 +1,26 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/brick0 +TEST $CLI volume start $V0 + +sleep 5 + +TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0 +cd $N0 + +TEST ls + +TEST $CLI volume set $V0 nfs.enable-ino32 on +# Main test. This should pass. +TEST ls + +cd +TEST umount $N0 +cleanup + diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index 0fe6b34d7d5..b3853ded5fa 100644 --- a/xlators/nfs/server/src/nfs-common.c +++ b/xlators/nfs/server/src/nfs-common.c @@ -417,6 +417,9 @@ nfs_hash_gfid (uuid_t gfid) uint32_t b1 = 0; uint32_t b2 = 0; + if (__is_root_gfid (gfid)) + return 0x1; + memcpy (&msb64, &gfid[8], 8); memcpy (&lsb64, &gfid[0], 8); -- cgit