Whamcloud - gitweb
b=24037 Remove iopen patch.
authoryangsheng <sheng.yang@oracle.com>
Wed, 8 Dec 2010 18:50:03 +0000 (02:50 +0800)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Fri, 10 Dec 2010 23:54:55 +0000 (02:54 +0300)
i=adilger
i=johann

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_fsfilt.h
lustre/include/linux/lustre_mds.h
lustre/include/obd.h
lustre/lvfs/fsfilt_ext3.c
lustre/mds/handler.c
lustre/mgs/mgs_fs.c
lustre/tests/sanity.sh
lustre/utils/mkfs_lustre.c

index 6edf267..8c411eb 100644 (file)
@@ -1962,6 +1962,16 @@ AC_DEFUN([LC_EXPORT_BDI_INIT],
 ])
 ])
 
+# 2.6.23 exports exportfs_decode_fh
+AC_DEFUN([LC_EXPORTFS_DECODE_FH],
+[LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
+[fs/exportfs/expfs.c],[
+        AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
+                [exportfs_decode_fh has been export])
+],[
+])
+])
+
 #
 # LC_PROG_LINUX
 #
@@ -2083,6 +2093,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_VM_OP_FAULT
          LC_REGISTER_SHRINKER
          LC_PROCFS_USERS
+         LC_EXPORTFS_DECODE_FH
   
         # 2.6.24
         LC_HAVE_MMTYPES_H
index f91f83d..b62f219 100644 (file)
@@ -58,6 +58,11 @@ struct fsfilt_objinfo {
         int fso_bufcnt;
 };
 
+struct fsfilt_fid {
+        __u32 ino;
+        __u32 gen;
+};
+
 struct lustre_dquot;
 struct fsfilt_operations {
         cfs_list_t fs_list;
@@ -125,6 +130,9 @@ struct fsfilt_operations {
                                 struct inode *inode, int frags);
         int     (* fs_dquot)(struct lustre_dquot *dquot, int cmd);
         lvfs_sbdev_type (* fs_journal_sbdev)(struct super_block *sb);
+        struct dentry  *(* fs_fid2dentry)(struct vfsmount *mnt,
+                                          struct fsfilt_fid *fid,
+                                          int ignore_gen);
 };
 
 extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
@@ -506,6 +514,16 @@ static inline __u64 fsfilt_get_version(struct obd_device *obd,
         return -EOPNOTSUPP;
 }
 
+static inline struct dentry *fsfilt_fid2dentry(struct obd_device *obd,
+                                               struct vfsmount *mnt,
+                                               struct fsfilt_fid *fid,
+                                               int ignore_gen)
+{
+        if (obd->obd_fsops->fs_fid2dentry)
+                return obd->obd_fsops->fs_fid2dentry(mnt, fid, ignore_gen);
+        return ERR_PTR(-EOPNOTSUPP);
+}
+
 #endif /* __KERNEL__ */
 
 #endif
index 4bfa21a..c843fe2 100644 (file)
@@ -73,8 +73,6 @@ struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
                                      struct vfsmount **mnt, int lock_mode,
                                      struct lustre_handle *lockh,
                                      __u64 lockpart);
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
-                              struct vfsmount **mnt);
 int mds_update_server_data(struct obd_device *, int force_sync);
 
 /* mds/mds_fs.c */
index 5b0c59a..5491b3c 100644 (file)
@@ -498,7 +498,6 @@ struct mgs_obd {
         struct vfsmount                 *mgs_vfsmnt;
         struct super_block              *mgs_sb;
         struct dentry                   *mgs_configs_dir;
-        struct dentry                   *mgs_fid_de;
         cfs_list_t                       mgs_fs_db_list;
         cfs_semaphore_t                  mgs_sem;
         cfs_proc_dir_entry_t            *mgs_proc_live;
@@ -510,7 +509,6 @@ struct mds_obd {
         struct ptlrpc_service           *mds_service;
         struct ptlrpc_service           *mds_setattr_service;
         struct ptlrpc_service           *mds_readpage_service;
-        cfs_dentry_t                    *mds_fid_de;
         int                              mds_max_mdsize;
         int                              mds_max_cookiesize;
         __u64                            mds_io_epoch;
index c89de20..f1ed390 100644 (file)
@@ -46,6 +46,9 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
+#ifdef HAVE_LINUX_EXPORTFS_H
+#include <linux/exportfs.h>
+#endif
 #ifdef HAVE_EXT4_LDISKFS
 #include <ext4/ext4.h>
 #include <ext4/ext4_jbd2.h>
@@ -2322,6 +2325,69 @@ void lustre_quota_journal_stop(void *handle)
         ext3_journal_stop((handle_t *)handle);
 }
 
+static int ll_decode_fh_accept(void *context, struct dentry *de)
+{
+        return 1;
+}
+
+#ifdef HAVE_EXPORTFS_DECODE_FH
+# define ll_exportfs_decode_fh(mnt, fid, len, type, acceptable, context) \
+         exportfs_decode_fh(mnt, (struct fid*)(fid), len, type,          \
+                            acceptable, context)
+#else
+# define ll_exportfs_decode_fh(mnt, fid, len, type, acceptable, context) \
+         export_op_default.decode_fh((mnt)->mnt_sb, &(fid)->ino, len,    \
+                                     type, acceptable, context)
+# define FILEID_INO32_GEN 1
+extern struct export_operations export_op_default;
+#endif
+
+struct dentry *fsfilt_ext3_fid2dentry(struct vfsmount *mnt,
+                                      struct fsfilt_fid *fid, int ignore_gen)
+{
+        struct inode  *inode;
+        struct dentry *result;
+        
+        result = ll_exportfs_decode_fh(mnt, fid, 2, FILEID_INO32_GEN,
+                                       ll_decode_fh_accept, NULL);
+        if (IS_ERR(result)) {
+                CDEBUG(D_DENTRY, "%s of %u/%u failed %ld\n", __func__,
+                       fid->ino, fid->gen, PTR_ERR(result));
+                return result;
+        }
+
+        CDEBUG(D_DENTRY, "%s of %u/%u succeeded\n", __func__,
+               fid->ino, fid->gen);
+        inode = result->d_inode;
+        if (inode == NULL)
+                goto err_out;
+
+        if (inode->i_nlink == 0 &&
+            inode->i_mode == 0 && LTIME_S(inode->i_ctime) == 0) {
+                LCONSOLE_WARN("Found inode with zero nlink, mode and"
+                              " ctime -- this may indicate disk "
+                              "corruption (inode: %lu, link: %lu, "
+                              "count: %d)\n", inode->i_ino,
+                              (unsigned long)inode->i_nlink,
+                              atomic_read(&inode->i_count));
+                goto err_out;
+        }
+        if (fid->gen && inode->i_generation != fid->gen) {
+                /* we didn't find the right inode.. */
+                CDEBUG(D_INODE, "found wrong generation: inode %lu, link: %lu, "
+                       "count: %d, generation %u/%u\n",
+                       inode->i_ino, (unsigned long)inode->i_nlink,
+                       atomic_read(&inode->i_count), inode->i_generation,
+                       fid->gen);
+                goto err_out;
+        }
+
+        return result;
+err_out:
+        l_dput(result);
+        return ERR_PTR(-ENOENT);
+}
+
 static struct fsfilt_operations fsfilt_ext3_ops = {
         .fs_type                = "ext3",
         .fs_owner               = THIS_MODULE,
@@ -2361,6 +2427,7 @@ static struct fsfilt_operations fsfilt_ext3_ops = {
         .fs_get_mblk            = fsfilt_ext3_get_mblk,
 #endif
         .fs_journal_sbdev       = fsfilt_ext3_journal_sbdev,
+        .fs_fid2dentry          = fsfilt_ext3_fid2dentry,
 };
 
 static int __init fsfilt_ext3_init(void)
index 9b015ca..35af1a9 100644 (file)
@@ -68,62 +68,6 @@ __u32 mds_max_ost_index=0xFFFF;
 CFS_MODULE_PARM(mds_max_ost_index, "i", int, 0444,
                 "maximal OST index");
 
-/* Look up an entry by inode number. */
-/* this function ONLY returns valid dget'd dentries with an initialized inode
-   or errors */
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
-                              struct vfsmount **mnt)
-{
-        char fid_name[32];
-        unsigned long ino = fid->id;
-        __u32 generation = fid->generation;
-        struct inode *inode;
-        struct dentry *result;
-
-        if (ino == 0)
-                RETURN(ERR_PTR(-ESTALE));
-
-        snprintf(fid_name, sizeof(fid_name), "0x%lx", ino);
-
-        /* under ext3 this is neither supposed to return bad inodes
-           nor NULL inodes. */
-        result = ll_lookup_one_len(fid_name, mds->mds_fid_de, strlen(fid_name));
-        if (IS_ERR(result))
-                RETURN(result);
-
-        inode = result->d_inode;
-        if (!inode)
-                RETURN(ERR_PTR(-ENOENT));
-
-        if (inode->i_generation == 0 || inode->i_nlink == 0) {
-                LCONSOLE_WARN("Found inode with zero generation or link -- this"
-                              " may indicate disk corruption (inode: %lu/%u, "
-                              "link %lu, count %d)\n", inode->i_ino,
-                              inode->i_generation,(unsigned long)inode->i_nlink,
-                              atomic_read(&inode->i_count));
-                dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        if (generation && inode->i_generation != generation) {
-                /* we didn't find the right inode.. */
-                CDEBUG(D_INODE, "found wrong generation: inode %lu, link: %lu, "
-                       "count: %d, generation %u/%u\n", inode->i_ino,
-                       (unsigned long)inode->i_nlink,
-                       atomic_read(&inode->i_count), inode->i_generation,
-                       generation);
-                dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        if (mnt) {
-                *mnt = mds->mds_obt.obt_vfsmnt;
-                mntget(*mnt);
-        }
-
-        RETURN(result);
-}
-
 static int mds_lov_presetup (struct mds_obd *mds, struct lustre_cfg *lcfg)
 {
         int rc = 0;
@@ -295,14 +239,22 @@ static int mds_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
         RETURN(rc);
 }
 
+/* Look up an entry by inode number. */
+/* this function ONLY returns valid dget'd dentries with an initialized inode
+   or errors */
 static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr,
                                           void *data)
 {
-        struct obd_device *obd = data;
-        struct ll_fid fid;
-        fid.id = id;
-        fid.generation = gen;
-        return mds_fid2dentry(&obd->u.mds, &fid, NULL);
+        struct fsfilt_fid  fid;
+        struct obd_device *obd = (struct obd_device *)data;
+
+        if (id == 0)
+                RETURN(ERR_PTR(-ESTALE));
+
+        fid.ino = id;
+        fid.gen = gen;
+
+        RETURN(fsfilt_fid2dentry(obd, obd->u.mds.mds_obt.obt_vfsmnt, &fid, 0));
 }
 
 
@@ -375,24 +327,10 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         }
         mds->mds_objects_dir = dentry;
 
-        dentry = ll_lookup_one_len("__iopen__", cfs_fs_pwd(current->fs),
-                                strlen("__iopen__"));
-        if (IS_ERR(dentry)) {
-                rc = PTR_ERR(dentry);
-                CERROR("cannot lookup __iopen__ directory: rc = %d\n", rc);
-                GOTO(err_objects, rc);
-        }
-
-        mds->mds_fid_de = dentry;
-        if (!dentry->d_inode || is_bad_inode(dentry->d_inode)) {
-                rc = -ENOENT;
-                CERROR("__iopen__ directory has no inode? rc = %d\n", rc);
-                GOTO(err_fid, rc);
-        }
         rc = mds_lov_init_objids(obd);
         if (rc != 0) {
                CERROR("cannot init lov objid rc = %d\n", rc);
-               GOTO(err_fid, rc );
+               GOTO(err_objects, rc );
         }
 
         rc = mds_lov_presetup(mds, lcfg);
@@ -413,8 +351,6 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 err_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         RETURN(rc);
-err_fid:
-        dput(mds->mds_fid_de);
 err_objects:
         dput(mds->mds_objects_dir);
 err_putfs:
@@ -447,7 +383,6 @@ static int mds_cmd_cleanup(struct obd_device *obd)
                 mds->mds_objects_dir = NULL;
         }
 
-        dput(mds->mds_fid_de);
         ll_vfs_dq_off(obd->u.obt.obt_sb, 0);
         shrink_dcache_sb(mds->mds_obt.obt_sb);
         fsfilt_put_ops(obd->obd_fsops);
index b4036b9..29bd959 100644 (file)
@@ -117,65 +117,27 @@ int mgs_client_free(struct obd_export *exp)
         return 0;
 }
 
-/* Same as mds_fid2dentry */
+/* Same as mds_lvfs_fid2dentry */
 /* Look up an entry by inode number. */
 /* this function ONLY returns valid dget'd dentries with an initialized inode
    or errors */
-static struct dentry *mgs_fid2dentry(struct mgs_obd *mgs,
-                                     __u64 ino, __u32 gen)
+static struct dentry *mgs_lvfs_fid2dentry(__u64 id, __u32 gen,
+                                          __u64 gr, void *data)
 {
-        char fid_name[32];
-        struct inode *inode;
-        struct dentry *result;
+        struct fsfilt_fid  fid;
+        struct obd_device *obd = (struct obd_device *)data;
         ENTRY;
 
         CDEBUG(D_DENTRY, "--> mgs_fid2dentry: ino/gen %lu/%u, sb %p\n",
-               (unsigned long)ino, gen, mgs->mgs_sb);
+               (unsigned long)id, gen, obd->u.mgs.mgs_sb);
 
-        if (ino == 0)
+        if (id == 0)
                 RETURN(ERR_PTR(-ESTALE));
 
-        snprintf(fid_name, sizeof(fid_name), "0x%lx", (unsigned long)ino);
-
-        /* under ext3 this is neither supposed to return bad inodes nor NULL
-           inodes. */
-        result = ll_lookup_one_len(fid_name, mgs->mgs_fid_de, strlen(fid_name));
-        if (IS_ERR(result))
-                RETURN(result);
-
-        inode = result->d_inode;
-        if (!inode)
-                RETURN(ERR_PTR(-ENOENT));
-
-        if (inode->i_generation == 0 || inode->i_nlink == 0) {
-                LCONSOLE_WARN("Found inode with zero generation or link -- this"
-                              " may indicate disk corruption (inode: %lu, link:"
-                              " %lu, count: %d)\n", inode->i_ino,
-                              (unsigned long)inode->i_nlink,
-                              atomic_read(&inode->i_count));
-                l_dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        if (gen && inode->i_generation != gen) {
-                /* we didn't find the right inode.. */
-                CDEBUG(D_INODE, "found wrong generation: inode %lu, link: %lu, "
-                       "count: %d, generation %u/%u\n", inode->i_ino,
-                       (unsigned long)inode->i_nlink,
-                       atomic_read(&inode->i_count),
-                       inode->i_generation, gen);
-                l_dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        RETURN(result);
-}
+        fid.ino = id;
+        fid.gen = gen;
 
-static struct dentry *mgs_lvfs_fid2dentry(__u64 id, __u32 gen,
-                                          __u64 gr, void *data)
-{
-        struct obd_device *obd = data;
-        return mgs_fid2dentry(&obd->u.mgs, id, gen);
+        RETURN(fsfilt_fid2dentry(obd, obd->u.mgs.mgs_vfsmnt, &fid, 0));
 }
 
 struct lvfs_callback_ops mgs_lvfs_ops = {
@@ -218,30 +180,9 @@ int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt)
         }
         mgs->mgs_configs_dir = dentry;
 
-        /* Need the iopen dir for fid2dentry, required by
-           LLOG_ORIGIN_HANDLE_READ_HEADER */
-        dentry = ll_lookup_one_len("__iopen__", cfs_fs_pwd(current->fs),
-                                strlen("__iopen__"));
-        if (IS_ERR(dentry)) {
-                rc = PTR_ERR(dentry);
-                CERROR("cannot lookup __iopen__ directory: rc = %d\n", rc);
-                GOTO(err_configs, rc);
-        }
-        mgs->mgs_fid_de = dentry;
-        if (!dentry->d_inode || is_bad_inode(dentry->d_inode)) {
-                rc = -ENOENT;
-                CERROR("__iopen__ directory has no inode? rc = %d\n", rc);
-                GOTO(err_fid, rc);
-        }
-
 err_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         return rc;
-err_fid:
-        dput(mgs->mgs_fid_de);
-err_configs:
-        dput(mgs->mgs_configs_dir);
-        goto err_pop;
 }
 
 int mgs_fs_cleanup(struct obd_device *obd)
@@ -259,7 +200,6 @@ int mgs_fs_cleanup(struct obd_device *obd)
                 mgs->mgs_configs_dir = NULL;
         }
 
-        dput(mgs->mgs_fid_de);
         shrink_dcache_sb(mgs->mgs_sb);
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
index 00e93b3..ae75d58 100644 (file)
@@ -3150,19 +3150,8 @@ test_54e() {
 }
 run_test 54e "console/tty device works in lustre ======================"
 
-test_55() {
-        rm -rf $DIR/d55
-        mkdir $DIR/d55
-        client_only && skip "Not a server" && return
-        mount -t $FSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error "mounting"
-        touch $DIR/d55/foo
-        $IOPENTEST1 $DIR/d55/foo $DIR/d55 || error "running $IOPENTEST1"
-        $IOPENTEST2 $DIR/d55 || error "running $IOPENTEST2"
-        echo "check for $EXT2_DEV. Please wait..."
-        rm -rf $DIR/d55/*
-        $UMOUNT $DIR/d55 || error "unmounting"
-}
-run_test 55 "check iopen_connect_dentry() ======================"
+#The test_55 used to be iopen test and it was removed by bz#24037. 
+#run_test 55 "check iopen_connect_dentry() ======================"
 
 test_56a() {   # was test_56
         rm -rf $DIR/d56
index 0e62785..0f74cc0 100644 (file)
@@ -1614,7 +1614,7 @@ int main(int argc, char *const argv[])
                 strscat(default_mountopts, ",errors=remount-ro",
                         sizeof(default_mountopts));
                 if (IS_MDT(ldd) || IS_MGS(ldd))
-                        strscat(always_mountopts, ",iopen_nopriv,user_xattr",
+                        strscat(always_mountopts, ",user_xattr",
                                 sizeof(always_mountopts));
                 if ((get_os_version() == 24) && IS_OST(ldd))
                         strscat(always_mountopts, ",asyncdel",