Whamcloud - gitweb
Branch b_release_1_4_6
authoradilger <adilger>
Tue, 20 Dec 2005 09:27:56 +0000 (09:27 +0000)
committeradilger <adilger>
Tue, 20 Dec 2005 09:27:56 +0000 (09:27 +0000)
Add /proc/fs/lustre/{mdc,osc}/*/connect_flags entries, so it is possible
to check what features are supported by a client.

12 files changed:
lustre/include/linux/lprocfs_status.h
lustre/include/linux/lustre_idl.h
lustre/lvfs/fsfilt_ext3.c
lustre/mdc/lproc_mdc.c
lustre/mdc/mdc_request.c
lustre/mds/lproc_mds.c
lustre/mds/mds_open.c
lustre/obdclass/lprocfs_status.c
lustre/osc/lproc_osc.c
lustre/ost/ost_handler.c
lustre/ptlrpc/service.c
lustre/tests/sanity.sh

index 5ef1d2e..541975c 100644 (file)
@@ -229,6 +229,8 @@ extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
                                   int count, int *eof, void *data);
 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
                                 int count, int *eof, void *data);
+extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
+                                    int count, int *eof, void *data);
 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
                                   int count, int *eof, void *data);
 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
@@ -326,6 +328,10 @@ static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
                                        int count, int *eof, void *data)
 { return 0; }
+static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
+                                           int count, int *eof, void *data)
+{ return 0; }
+
 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
                                          int count, int *eof, void *data)
 { return 0; }
index a5425fd..7bab5ce 100644 (file)
@@ -229,13 +229,12 @@ static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
 #define OBD_CONNECT_REQPORTAL   0x40ULL /* Separate portal for non-IO reqs */
 #define OBD_CONNECT_ACL         0x80ULL /* client using access control lists */
 #define OBD_CONNECT_XATTR      0x100ULL /* client using extended attributes*/
-
-
 #define OBD_CONNECT_CROW       0x200ULL /* MDS+OST do object create-on-write */
 #define OBD_CONNECT_TRUNCLOCK  0x400ULL /* server gets locks for punch b=9528 */
 #define OBD_CONNECT_TRANSNO    0x800ULL /* replay is sending initial transno */
 #define OBD_CONNECT_IBITS     0x1000ULL /* support for inodebits locks */
 #define OBD_CONNECT_JOIN      0x2000ULL /* files can be concatenated */
+/* also update obd_connect_names[] for lprocfs_rd_connect_flags() */
 
 #define MDS_CONNECT_SUPPORTED  (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \
                                 OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \
index 7d4921a..e8dd5e0 100644 (file)
@@ -1802,17 +1802,17 @@ static int fsfilt_ext3_quotacheck(struct super_block *sb,
         for (i = 0; i < MAXQUOTAS; i++) {
                 struct list_head id_list;
                 struct dquot_id *dqid, *tmp;
-                
+
                 if (!Q_TYPESET(oqc, i))
                         continue;
-                
+
                 if (qctxt->qckt_first_check[i])
                         continue;
-                
+
                 dummy->qi_files[i] = dqopt->files[i];
                 LASSERT(dummy->qi_files[i] != NULL);
                 INIT_LIST_HEAD(&id_list);
-                
+
                 rc = lustre_get_qids(dummy, i, &id_list);
                 if (rc) {
                         CERROR("read old limits failed. (rc:%d)\n", rc);
@@ -1820,7 +1820,7 @@ static int fsfilt_ext3_quotacheck(struct super_block *sb,
                 }
                 list_for_each_entry_safe(dqid, tmp, &id_list, di_link) {
                         list_del_init(&dqid->di_link);
-                        
+
                         cqget(sb, qctxt->qckt_hash, &qctxt->qckt_list, 
                               dqid->di_id, i, qctxt->qckt_first_check[i]);
                         kfree(dqid);
index 02b06ca..195bbff 100644 (file)
@@ -33,6 +33,7 @@
 static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "uuid",            lprocfs_rd_uuid,        0, 0 },
         { "ping",            0, lprocfs_wr_ping,        0 },
+        { "connect_flags",   lprocfs_rd_connect_flags, 0, 0 },
         { "blocksize",       lprocfs_rd_blksize,     0, 0 },
         { "kbytestotal",     lprocfs_rd_kbytestotal, 0, 0 },
         { "kbytesfree",      lprocfs_rd_kbytesfree,  0, 0 },
index 1dc13f9..5f78fa9 100644 (file)
@@ -680,9 +680,8 @@ int mdc_close(struct obd_export *exp, struct obdo *oa,
         LASSERT(req->rq_cb_data == NULL);
         req->rq_cb_data = mod;
 
-        CDEBUG(D_HA, "close req->rep_len: %d\n", req->rq_replen);
-
-        CDEBUG(D_HA, "close max_mdsize/max_cookiesize: %d/%d\n",
+        CDEBUG(D_HA, "close req->rep_len %d mdsize %d cookiesize %d\n",
+               req->rq_replen,
                obd->u.cli.cl_max_mds_easize, obd->u.cli.cl_max_mds_cookiesize);
 
         /* We hand a ref to the rpcd here, so we need another one of our own. */
index 78d3e3f..137aa2c 100644 (file)
@@ -366,8 +366,8 @@ struct lprocfs_vars lprocfs_mds_obd_vars[] = {
                              lprocfs_wr_group_acquire_expire, 0},
         { "group_upcall",    lprocfs_rd_group_upcall,
                              lprocfs_wr_group_upcall, 0},
-        { "group_flush", 0,  lprocfs_wr_group_flush, 0},
-        { "group_info", 0,   lprocfs_wr_group_info, 0 },
+        { "group_flush",     0, lprocfs_wr_group_flush, 0},
+        { "group_info",      0, lprocfs_wr_group_info, 0 },
         { 0 }
 };
 
index 937f03e..6546fc6 100644 (file)
@@ -1364,11 +1364,10 @@ int mds_close(struct ptlrpc_request *req, int offset)
                 MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
         }
 
-        CDEBUG(D_HA, "close req->rep_len: %d\n", req->rq_replen);
-
-        CDEBUG(D_HA, "close max_mdsize/max_cookiesize: %d/%d\n",
+        CDEBUG(D_HA, "close req->rep_len %d mdsize %d cookiesize %d\n",
+               req->rq_replen,
                obd->u.mds.mds_max_mdsize, obd->u.mds.mds_max_cookiesize);
-        
+
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
         if (body == NULL) {
index 32ecb74..1768612 100644 (file)
@@ -356,6 +356,49 @@ int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count,
         return snprintf(page, count, "%s\n", conn->c_remote_uuid.uuid);
 }
 
+static const char *obd_connect_names[] = {
+        "read_only",
+        "lov_index",
+        "unused",
+        "write_grant",
+        "server_lock",
+        "version",
+        "request_portal",
+        "acl",
+        "xattr",
+        "create_on_write",
+        "truncate_lock",
+        "initial_transno",
+        "inode_bit_locks",
+        "join_file",
+        NULL
+};
+
+int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
+                             int count, int *eof, void *data)
+{
+        struct obd_device *obd = data;
+        __u64 mask = 1, flags;
+        int i, ret;
+
+        if (obd == NULL)
+                return 0;
+
+        flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;
+        ret = snprintf(page, count, "flags="LPX64"\n", flags);
+        for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+                if (flags & mask)
+                        ret += snprintf(page + ret, count - ret, "%s\n",
+                                        obd_connect_names[i]);
+        }
+        if (flags & ~(mask - 1))
+                ret += snprintf(page + ret, count - ret,
+                                "unknown flags "LPX64"\n", flags & ~(mask - 1));
+
+        return ret;
+}
+EXPORT_SYMBOL(lprocfs_rd_connect_flags);
+
 int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count,
                            int *eof,  void *data)
 {
index b4ca5d9..1c9afe6 100644 (file)
@@ -261,6 +261,7 @@ static int osc_wr_checksum(struct file *file, const char *buffer,
 static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "uuid",            lprocfs_rd_uuid,        0, 0 },
         { "ping",            0, lprocfs_wr_ping,        0 },
+        { "connect_flags",   lprocfs_rd_connect_flags, 0, 0 },
         { "blocksize",       lprocfs_rd_blksize,     0, 0 },
         { "kbytestotal",     lprocfs_rd_kbytestotal, 0, 0 },
         { "kbytesfree",      lprocfs_rd_kbytesfree,  0, 0 },
@@ -274,13 +275,13 @@ static struct lprocfs_vars lprocfs_obd_vars[] = {
                                osc_wr_max_pages_per_rpc, 0 },
         { "max_rpcs_in_flight", osc_rd_max_rpcs_in_flight,
                                 osc_wr_max_rpcs_in_flight, 0 },
-        { "max_dirty_mb", osc_rd_max_dirty_mb, osc_wr_max_dirty_mb, 0 },
+        { "max_dirty_mb",    osc_rd_max_dirty_mb, osc_wr_max_dirty_mb, 0 },
         { "cur_dirty_bytes", osc_rd_cur_dirty_bytes, 0, 0 },
         { "cur_grant_bytes", osc_rd_cur_grant_bytes, 0, 0 },
-        { "create_count", osc_rd_create_count, osc_wr_create_count, 0 },
+        { "create_count",    osc_rd_create_count, osc_wr_create_count, 0 },
         { "prealloc_next_id", osc_rd_prealloc_next_id, 0, 0 },
         { "prealloc_last_id", osc_rd_prealloc_last_id, 0, 0 },
-        { "checksums", osc_rd_checksum, osc_wr_checksum, 0 },
+        { "checksums",       osc_rd_checksum, osc_wr_checksum, 0 },
         { 0 }
 };
 
index dbc7dd1..9756c60 100644 (file)
@@ -65,6 +65,7 @@ void oti_to_request(struct obd_trans_info *oti, struct ptlrpc_request *req)
 
         if (req->rq_repmsg)
                 req->rq_repmsg->transno = oti->oti_transno;
+        req->rq_transno = oti->oti_transno;
 
         /* XXX 4 == entries in oti_ack_locks??? */
         for (ack_lock = oti->oti_ack_locks, i = 0; i < 4; i++, ack_lock++) {
index b3492e8..5dcb8d1 100644 (file)
@@ -576,6 +576,7 @@ put_conn:
                        libcfs_id2str(request->rq_peer),
                        timeval_sub(&work_end,
                                    &request->rq_arrival_time) / 1000000,
+                       request->rq_repmsg ? request->rq_repmsg->transno :
                        request->rq_transno, request->rq_status,
                        request->rq_repmsg ? request->rq_repmsg->status : -999);
         else
index 662ee10..de17cc2 100644 (file)
@@ -113,6 +113,8 @@ run_one() {
        BEFORE=`date +%s`
        log "== test $1: $2= `date +%H:%M:%S` ($BEFORE)"
        export TESTNAME=test_$1
+       export tfile=f${testnum}
+       export tdir=d${base}
        test_$1 || error "exit with rc=$?"
        unset TESTNAME
        pass "($((`date +%s` - $BEFORE))s)"
@@ -700,7 +702,11 @@ run_test 24l "Renaming a file to itself ========================"
 
 test_24m() {
        f="$DIR/f24m"
-       multiop $f OcLN ${f}2 ${f}2 || error
+       multiop $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
+       # on ext3 this does not remove either the source or target files
+       # though the "expected" operation would be to remove the source
+       $CHECKSTAT -t file ${f} || error "${f} missing"
+       $CHECKSTAT -t file ${f}2 || error "${f}2 missing"
 }
 run_test 24m "Renaming a file to a hard link to itself ========="
 
@@ -2789,7 +2795,7 @@ test_102() {
         touch $testfile
 
        [ "$UID" != 0 ] && echo "skipping $TESTNAME (must run as root)" && return
-       [ -z "`mount | grep " $DIR .*\<user_xattr\>"`" ] && echo "skipping $TESTNAME (must have user_xattr)" && return
+       [ -z "grep \<xattr\> /proc/fs/lustre/mdc/MDC*MNT*/connect_flags" ] && echo "skipping $TESTNAME (must have user_xattr)" && return
        echo "set/get xattr..."
         setfattr -n trusted.name1 -v value1 $testfile || error
         [ "`getfattr -n trusted.name1 $testfile 2> /dev/null | \
@@ -2840,6 +2846,7 @@ test_103 () {
 
     [ "$UID" != 0 ] && echo "skipping $TESTNAME (must run as root)" && return
     [ -z "`mount | grep " $DIR .*\<acl\>"`" ] && echo "skipping $TESTNAME (must have acl)" && return
+    [ -z "grep \<acl\> /proc/fs/lustre/osc/OSC*MNT*/connect_flags" ] && echo "skipping $TESTNAME (must have acl)" && return
 
     echo "performing cp ..."
     run_acl_subtest cp || error