Whamcloud - gitweb
correctly handling request reference in error cases
authorshadow <shadow>
Fri, 31 Jul 2009 10:23:31 +0000 (10:23 +0000)
committershadow <shadow>
Fri, 31 Jul 2009 10:23:31 +0000 (10:23 +0000)
Branch HEAD
b=20122
i=adilger
i=panda

lustre/ChangeLog
lustre/include/obd_support.h
lustre/llite/symlink.c
lustre/mdt/mdt_handler.c
lustre/tests/sanity.sh

index bf325c6..9b8bd80 100644 (file)
@@ -13,6 +13,11 @@ tbd  Sun Microsystems, Inc.
         removed cwd "./" (refer to Bugzilla 14399).
        * File join has been disabled in this release, refer to Bugzilla 16929.
 
+Severity   : normal
+Bugzilla   : 20122
+Description: don't panic if EPROTO was hit when reading symlink 
+Details    : correctly handling request reference in error cases.
+
 Severity   : enhancement
 Bugzilla   : 19856
 Description: Add LustreNetLink, a kernel-userspace communcation path.
index e482567..47dc072 100644 (file)
@@ -206,6 +206,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_MDS_LOV_PREP_CREATE     0x141
 #define OBD_FAIL_MDS_REINT_DELAY         0x142
 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE    0x143
+#define OBD_FAIL_MDS_READLINK_EPROTO     0x144
 
 /* CMD */
 #define OBD_FAIL_MDS_IS_SUBDIR_NET       0x180
@@ -314,7 +315,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_PTLRPC_PAUSE_REQ        0x50a
 #define OBD_FAIL_PTLRPC_PAUSE_REP        0x50c
 #define OBD_FAIL_PTLRPC_IMP_DEACTIVE     0x50d
-
 #define OBD_FAIL_PTLRPC_DUMP_LOG         0x50e
 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
 #define OBD_FAIL_PTLRPC_LONG_BULK_UNLINK 0x510
index ff1c99a..7db4a19 100644 (file)
@@ -99,15 +99,11 @@ static int ll_readlink_internal(struct inode *inode,
         /* do not return an error if we cannot cache the symlink locally */
         if (lli->lli_symlink_name) {
                 memcpy(lli->lli_symlink_name, *symname, symlen);
-                ptlrpc_req_finished (*request);
-                *request = NULL;
                 *symname = lli->lli_symlink_name;
         }
-
         RETURN(0);
 
- failed:
-        ptlrpc_req_finished (*request);
+failed:
         RETURN (rc);
 }
 
@@ -127,8 +123,8 @@ static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
                 GOTO(out, rc);
 
         rc = vfs_readlink(dentry, buffer, buflen, symname);
-        ptlrpc_req_finished(request);
  out:
+        ptlrpc_req_finished(request);
         ll_inode_size_unlock(inode, 0);
         RETURN(rc);
 }
@@ -187,10 +183,10 @@ static LL_FOLLOW_LINK_RETURN_TYPE ll_follow_link(struct dentry *dentry,
            we delay request releasing until ll_put_link then. */
         RETURN(request);
 #else
-        if (request != NULL) {
+        if (lli->lli_symlink_name == NULL) {
                 /* falling back to recursive follow link if the request
                  * needs to be cleaned up still. */
-        rc = vfs_follow_link(nd, symname);
+                rc = vfs_follow_link(nd, symname);
                 GOTO(out, rc);
         }
         nd_set_link(nd, symname);
index 2bb3866..6602382 100644 (file)
@@ -523,6 +523,8 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                         CERROR("readlink failed: %d\n", rc);
                         rc = -EFAULT;
                 } else {
+                        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_READLINK_EPROTO))
+                                 rc -= 2;
                         repbody->valid |= OBD_MD_LINKNAME;
                         repbody->eadatasize = rc;
                         /* NULL terminate */
index f838a5f..1752ca8 100644 (file)
@@ -482,6 +482,17 @@ test_17h() { #bug 17378
 }
 run_test 17h "create objects: lov_free_memmd() doesn't lbug"
 
+test_17i() { #bug 20018
+        mkdir -p $DIR/$tdir
+       local foo=$DIR/$tdir/$tfile
+       ln -s $foo $foo || error "create symlink failed"
+#define OBD_FAIL_MDS_READLINK_EPROTO     0x143
+       do_facet mds lctl set_param fail_loc=0x80000144
+       ls -l $foo && error "error not detected"
+       return 0
+}
+run_test 17i "don't panic on short symlink"
+
 test_18() {
        touch $DIR/f
        ls $DIR || error