Whamcloud - gitweb
LU-9115 llite: buggy special handling on MULTIMODRPCS
[fs/lustre-release.git] / lustre / llite / llite_lib.c
index edae212..7ec723d 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -219,7 +215,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                  OBD_CONNECT_DIR_STRIPE |
                                  OBD_CONNECT_BULK_MBITS |
                                  OBD_CONNECT_SUBTREE |
-                                 OBD_CONNECT_FLAGS2;
+                                 OBD_CONNECT_FLAGS2 | OBD_CONNECT_MULTIMODRPCS;
 
        data->ocd_connect_flags2 = 0;
 
@@ -304,15 +300,15 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
            valid != CLIENT_CONNECT_MDT_REQD) {
                char *buf;
 
-               OBD_ALLOC_WAIT(buf, PAGE_CACHE_SIZE);
-               obd_connect_flags2str(buf, PAGE_CACHE_SIZE,
+               OBD_ALLOC_WAIT(buf, PAGE_SIZE);
+               obd_connect_flags2str(buf, PAGE_SIZE,
                                      valid ^ CLIENT_CONNECT_MDT_REQD, 0, ",");
                LCONSOLE_ERROR_MSG(0x170, "Server %s does not support "
                                   "feature(s) needed for correct operation "
                                   "of this client (%s). Please upgrade "
                                   "server or downgrade client.\n",
                                   sbi->ll_md_exp->exp_obd->obd_name, buf);
-               OBD_FREE(buf, PAGE_CACHE_SIZE);
+               OBD_FREE(buf, PAGE_SIZE);
                GOTO(out_md_fid, err = -EPROTO);
        }
 
@@ -326,11 +322,12 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        }
 
        LASSERT(osfs->os_bsize);
-        sb->s_blocksize = osfs->os_bsize;
-        sb->s_blocksize_bits = log2(osfs->os_bsize);
-        sb->s_magic = LL_SUPER_MAGIC;
-        sb->s_maxbytes = MAX_LFS_FILESIZE;
-        sbi->ll_namelen = osfs->os_namelen;
+       sb->s_blocksize = osfs->os_bsize;
+       sb->s_blocksize_bits = log2(osfs->os_bsize);
+       sb->s_magic = LL_SUPER_MAGIC;
+       sb->s_maxbytes = MAX_LFS_FILESIZE;
+       sbi->ll_namelen = osfs->os_namelen;
+       sbi->ll_mnt.mnt = current->fs->root.mnt;
 
         if ((sbi->ll_flags & LL_SBI_USER_XATTR) &&
             !(data->ocd_connect_flags & OBD_CONNECT_XATTR)) {
@@ -356,7 +353,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                 sbi->ll_flags |= LL_SBI_64BIT_HASH;
 
        if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE)
-               sbi->ll_md_brw_pages = data->ocd_brw_size >> PAGE_CACHE_SHIFT;
+               sbi->ll_md_brw_pages = data->ocd_brw_size >> PAGE_SHIFT;
        else
                sbi->ll_md_brw_pages = 1;
 
@@ -424,7 +421,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        if (sbi->ll_flags & LL_SBI_ALWAYS_PING)
                data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS;
 
-       CDEBUG(D_RPCTRACE, "ocd_connect_flags: "LPX64" ocd_version: %d "
+       CDEBUG(D_RPCTRACE, "ocd_connect_flags: %#llx ocd_version: %d "
               "ocd_grant: %d\n", data->ocd_connect_flags,
               data->ocd_version, data->ocd_grant);
 
@@ -958,6 +955,7 @@ void ll_lli_init(struct ll_inode_info *lli)
                lli->lli_async_rc = 0;
        }
        mutex_init(&lli->lli_layout_mutex);
+       memset(lli->lli_jobid, 0, LUSTRE_JOBID_SIZE);
 }
 
 static inline int ll_bdi_register(struct backing_dev_info *bdi)
@@ -1027,6 +1025,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
         cfg->cfg_instance = sb;
         cfg->cfg_uuid = lsi->lsi_llsbi->ll_sb_uuid;
        cfg->cfg_callback = class_config_llog_handler;
+       cfg->cfg_sub_clds = CONFIG_SUB_CLIENT;
         /* set up client obds */
         err = lustre_process_log(sb, profilenm, cfg);
        if (err < 0)
@@ -1567,7 +1566,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
                  * OST maximum object size and number of stripes.  This
                  * needs another check in addition to the VFS check above. */
                 if (attr->ia_size > ll_file_maxbytes(inode)) {
-                        CDEBUG(D_INODE,"file "DFID" too large %llu > "LPU64"\n",
+                       CDEBUG(D_INODE,"file "DFID" too large %llu > %llu\n",
                                PFID(&lli->lli_fid), attr->ia_size,
                                ll_file_maxbytes(inode));
                         RETURN(-EFBIG);
@@ -1742,7 +1741,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
 
         osfs->os_type = sb->s_magic;
 
-        CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
+       CDEBUG(D_SUPER, "MDC blocks %llu/%llu objects %llu/%llu\n",
                osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
 
         if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
@@ -1754,7 +1753,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
                 RETURN(rc);
         }
 
-        CDEBUG(D_SUPER, "OSC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
+       CDEBUG(D_SUPER, "OSC blocks %llu/%llu objects %llu/%llu\n",
                obd_osfs.os_bavail, obd_osfs.os_blocks, obd_osfs.os_ffree,
                obd_osfs.os_files);
 
@@ -1782,7 +1781,7 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
        __u64 fsid = huge_encode_dev(sb->s_dev);
        int rc;
 
-        CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
+       CDEBUG(D_VFSTRACE, "VFS Op: at %llu jiffies\n", get_jiffies_64());
         ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
 
         /* Some amount of caching on the client is allowed */
@@ -1873,7 +1872,7 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)
        if (body->mbo_valid & OBD_MD_FLMTIME) {
                if (body->mbo_mtime > LTIME_S(inode->i_mtime)) {
                        CDEBUG(D_INODE, "setting ino %lu mtime from %lu "
-                              "to "LPU64"\n", inode->i_ino,
+                              "to %llu\n", inode->i_ino,
                               LTIME_S(inode->i_mtime), body->mbo_mtime);
                        LTIME_S(inode->i_mtime) = body->mbo_mtime;
                }
@@ -2132,6 +2131,8 @@ void ll_umount_begin(struct super_block *sb)
        struct ll_sb_info *sbi = ll_s2sbi(sb);
        struct obd_device *obd;
        struct obd_ioctl_data *ioc_data;
+       struct l_wait_info lwi;
+       wait_queue_head_t waitq;
        ENTRY;
 
        CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
@@ -2139,7 +2140,7 @@ void ll_umount_begin(struct super_block *sb)
 
        obd = class_exp2obd(sbi->ll_md_exp);
        if (obd == NULL) {
-               CERROR("Invalid MDC connection handle "LPX64"\n",
+               CERROR("Invalid MDC connection handle %#llx\n",
                       sbi->ll_md_exp->exp_handle.h_cookie);
                EXIT;
                return;
@@ -2148,7 +2149,7 @@ void ll_umount_begin(struct super_block *sb)
 
         obd = class_exp2obd(sbi->ll_dt_exp);
         if (obd == NULL) {
-                CERROR("Invalid LOV connection handle "LPX64"\n",
+               CERROR("Invalid LOV connection handle %#llx\n",
                        sbi->ll_dt_exp->exp_handle.h_cookie);
                 EXIT;
                 return;
@@ -2167,10 +2168,14 @@ void ll_umount_begin(struct super_block *sb)
        }
 
        /* Really, we'd like to wait until there are no requests outstanding,
-        * and then continue.  For now, we just invalidate the requests,
-        * schedule() and sleep one second if needed, and hope.
+        * and then continue.  For now, we just periodically checking for vfs
+        * to decrement mnt_cnt and hope to finish it within 10sec.
         */
-       schedule();
+       init_waitqueue_head(&waitq);
+       lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(10),
+                                  cfs_time_seconds(1), NULL, NULL);
+       l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi);
+
        EXIT;
 }
 
@@ -2241,7 +2246,7 @@ void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req)
 
        op_data->op_fid1 = body->mbo_fid1;
        op_data->op_handle = body->mbo_handle;
-       op_data->op_mod_time = cfs_time_current_sec();
+       op_data->op_mod_time = ktime_get_real_seconds();
        md_close(exp, op_data, NULL, &close_req);
        ptlrpc_req_finished(close_req);
        ll_finish_md_op_data(op_data);
@@ -2660,7 +2665,7 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
        struct root_squash_info *squash = &sbi->ll_squash;
        int i;
        bool matched;
-       lnet_process_id_t id;
+       struct lnet_process_id id;
 
        /* Update norootsquash flag */
        down_write(&squash->rsi_sem);
@@ -2705,7 +2710,7 @@ static int ll_linkea_decode(struct linkea_data *ldata, unsigned int linkno,
        int             rc;
        ENTRY;
 
-       rc = linkea_init(ldata);
+       rc = linkea_init_with_rec(ldata);
        if (rc < 0)
                RETURN(rc);