From 5d6f55ed9f122d3aeab583bb0ad16cb0c392a339 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 17 Jul 2014 12:15:54 +0530 Subject: snapview-server: get the handle if its absent before doing any fop * Now that NFS server does inode linking in readdirp, it can resolve the gfid (i.e. find the right inode from its inode table) present in the filehandle sent by the NFS client on which a fop came. So instead of sending the lookup on that entry, it directly sends the fop. But snapview-server does not get the handle for the entries in readdirp (because doing a lookup on each entry via gfapi would be costly. So it waits till a lookup is done on that inode, to get the handle and the fs instance and fill it in the inode context). So when NFS resoves the gfid and directly sends the fop, snapview-server will not be able to perform the fop as the inode contet would not contain the fs instance and the handle. So fops should check for the handle before doing gfapi calls. If the handle and fs instance are not present in the inode context they should get them by doing an explicit lookup on the entry. Change-Id: Idd648fbcc3ff6aadc3b63ff236561ca967b92f5d BUG: 1115949 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/8324 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/basic/uss.t | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'tests/basic') diff --git a/tests/basic/uss.t b/tests/basic/uss.t index f97cd59883e..04d4baf64a5 100644 --- a/tests/basic/uss.t +++ b/tests/basic/uss.t @@ -101,20 +101,31 @@ TEST fd_close $fd3 # test 44 TEST mount_nfs $H0:/$V0 $N0 nolock; -TEST ls -l $N0/.snaps; - NUM_SNAPS=$(ls $N0/.snaps | wc -l); TEST [ $NUM_SNAPS == 4 ]; +TEST stat $N0/.snaps/snap1; +TEST stat $N0/.snaps/snap2; + +TEST ls -l $N0/.snaps; + +# readdir + lookup on each entry TEST ls -l $N0/.snaps/snap1; TEST ls -l $N0/.snaps/snap2; -TEST ls -l $N0/.snaps/snap3; -TEST ls -l $N0/.snaps/snap4; + +# readdir + access each entry by doing stat. If snapview-server has not +# filled the fs instance and handle in the inode context of the entry as +# part of readdirp, then when stat comes (i.e fop comes directly without +# a previous lookup), snapview-server should do a lookup of the entry via +# gfapi call and fill in the fs instance + handle information in the inode +# context +TEST ls $N0/.snaps/snap3/; +TEST stat $N0/.snaps/snap3/dir1; +TEST stat $N0/.snaps/snap3/dir2; TEST ls -l $N0/.snaps/snap3/dir1; TEST ls -l $N0/.snaps/snap3/dir2; - TEST ls -l $N0/.snaps/snap4/dir1; TEST ls -l $N0/.snaps/snap4/dir2; @@ -123,6 +134,7 @@ TEST ! ls -l $N0/dir2/.snaps/snap2; TEST ls -l $N0/dir1/.snaps/snap3; TEST ls -l $N0/dir2/.snaps/snap4; + TEST fd1=`fd_available` TEST fd_open $fd1 'r' $N0/.snaps/snap1/file1; TEST fd_cat $fd1 -- cgit