Whamcloud - gitweb
Instrumentation for reproducing and verifying 1897 (open-count leaked if close
authorshaver <shaver>
Wed, 3 Dec 2003 21:39:49 +0000 (21:39 +0000)
committershaver <shaver>
Wed, 3 Dec 2003 21:39:49 +0000 (21:39 +0000)
is interrupted on the client). r=robert.

lustre/include/linux/obd.h
lustre/mds/handler.c
lustre/mds/lproc_mds.c
lustre/mds/mds_open.c
lustre/tests/llmount-upcall.sh [new file with mode: 0755]

index 03ea9c9..8c85be5 100644 (file)
@@ -258,6 +258,8 @@ struct mds_obd {
         struct file                     *mds_lov_objid_filp;
         unsigned long                   *mds_client_bitmap;
         struct semaphore                 mds_orphan_recovery_sem;
+
+        atomic_t                         mds_open_count;
 };
 
 struct echo_obd {
index 0f0a608..82e16ac 100644 (file)
@@ -1301,6 +1301,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         spin_lock_init(&mds->mds_transno_lock);
         mds->mds_max_mdsize = sizeof(struct lov_mds_md);
         mds->mds_max_cookiesize = sizeof(struct llog_cookie);
+        atomic_set(&mds->mds_open_count, 0);
 
         obd->obd_namespace = ldlm_namespace_new("mds_server",
                                                 LDLM_NAMESPACE_SERVER);
index fe883d9..59b3401 100644 (file)
@@ -49,6 +49,17 @@ static int lprocfs_mds_rd_mntdev(char *page, char **start, off_t off, int count,
         return snprintf(page, count, "%s\n",obd->u.mds.mds_vfsmnt->mnt_devname);
 }
 
+static int lprocfs_mds_rd_filesopen(char *page, char **start, off_t off,
+                                    int count, int *eof, void *data)
+{
+        struct obd_device *obd = data;
+        LASSERT(obd != NULL);
+        *eof = 1;
+
+        return snprintf(page, count, "%d\n",
+                        atomic_read(&obd->u.mds.mds_open_count));
+}
+
 static int lprocfs_mds_rd_recovery_status(char *page, char **start, off_t off,
                                           int count, int *eof, void *data)
 {
@@ -150,6 +161,7 @@ struct lprocfs_vars lprocfs_mds_obd_vars[] = {
         { "fstype",       lprocfs_rd_fstype,      0, 0 },
         { "filestotal",   lprocfs_rd_filestotal,  0, 0 },
         { "filesfree",    lprocfs_rd_filesfree,   0, 0 },
+        { "filesopen",    lprocfs_mds_rd_filesopen,   0, 0 },
         //{ "filegroups",   lprocfs_rd_filegroups,  0, 0 },
         { "mntdev",       lprocfs_mds_rd_mntdev,  0, 0 },
         { "recovery_status", lprocfs_mds_rd_recovery_status, 0, 0 },
index 89f2edb..4f6df75 100644 (file)
@@ -963,6 +963,8 @@ int mds_open(struct mds_update_record *rec, int offset,
                 else
                         ldlm_put_lock_into_req(req, &parent_lockh, parent_mode);
         }
+        if (rc == 0)
+                atomic_inc(&mds->mds_open_count);
         RETURN(rc);
 }
 
@@ -1085,6 +1087,7 @@ int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
         mds_mfd_destroy(mfd);
 
  cleanup:
+        atomic_dec(&mds->mds_open_count);
         if (req) {
                 rc = mds_finish_transno(mds, pending_dir, handle, req, rc, 0);
         } else if (handle) {
diff --git a/lustre/tests/llmount-upcall.sh b/lustre/tests/llmount-upcall.sh
new file mode 100755 (executable)
index 0000000..f5a1ef7
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+LUSTRE=`dirname $0`/..
+exec >> /tmp/recovery-`hostname`.log
+exec 2>&1
+
+$LUSTRE/utils/lconf --recover --verbose --tgt_uuid $2 --client_uuid $3 --conn_uuid $4 $LUSTRE/tests/local.xml