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

lustre/ChangeLog
lustre/include/obd_support.h
lustre/llite/symlink.c
lustre/mds/handler.c
lustre/tests/sanity.sh

index 1247bec..8567a21 100644 (file)
@@ -14,6 +14,12 @@ tbd Sun Microsystems, Inc.
          of Lustre filesystem with 4K stack may cause a stack overflow. For
          more information, please refer to bugzilla 17630.
 
+
+Severity   : normal
+Bugzilla   : 20122
+Description: don't panic if EPROTO was hit when reading symlink 
+Details    : correctly handling request reference in error cases.
+
 Severity   : normal
 Bugzilla   : 17545
 Description: open sometimes returns ENOENT instead of EACCES
index b50e3bb..2b0988b 100644 (file)
@@ -191,6 +191,7 @@ extern unsigned int obd_alloc_fail_rate;
 #define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD    0x140
 #define OBD_FAIL_MDS_LOV_PREP_CREATE     0x141
 #define OBD_FAIL_MDS_SPLIT_OPEN          0x142
+#define OBD_FAIL_MDS_READLINK_EPROTO     0x143
 
 #define OBD_FAIL_OST                     0x200
 #define OBD_FAIL_OST_CONNECT_NET         0x201
@@ -290,7 +291,6 @@ extern unsigned int obd_alloc_fail_rate;
 #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 351c837..19cd222 100644 (file)
@@ -102,15 +102,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);
 }
 
@@ -131,8 +127,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);
         up(&lli->lli_size_sem);
         RETURN(rc);
 }
@@ -194,7 +190,7 @@ static LL_FOLLOW_LINK_RETURN_TYPE ll_follow_link(struct dentry *dentry, struct n
            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);
index 2407e33..b024261 100644 (file)
@@ -772,6 +772,9 @@ static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
                                 rc, len - 1);
                         rc = -EINVAL;
                 } else {
+                        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_READLINK_EPROTO))
+                                rc -= 2;
+
                         CDEBUG(D_INODE, "read symlink dest %s\n", symname);
                         body->valid |= OBD_MD_LINKNAME;
                         body->eadatasize = rc + 1;
index c0b9136..7a96c7a 100644 (file)
@@ -458,6 +458,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=0x80000143
+       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