Whamcloud - gitweb
b=21610 Changes for 2.6.32 kernel udpate.
authoryangsheng <sheng.yang@sun.com>
Wed, 3 Nov 2010 06:55:01 +0000 (14:55 +0800)
committerVitaly Fertman <vitaly.fertman@sun.com>
Thu, 4 Nov 2010 18:09:35 +0000 (21:09 +0300)
i=Andreas.Dilger
i=Mikhail.Pershin

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/file.c
lustre/lvfs/fsfilt_ext3.c
lustre/mgs/mgs_llog.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_io_26.c
lustre/osd-ldiskfs/osd_handler.c

index 6e08d2a..07d339e 100644 (file)
@@ -1667,15 +1667,21 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.27 sles11 move the quotaio_v1.h to fs
+#
+# 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
+# 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
 AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
         AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
                 [kernel has include/linux/quotaio_v1.h])
+],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v1.h],[
+               AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1,
+                [kernel has fs/quota/quotaio_v1.h])
 ],[
         AC_MSG_RESULT([no])
 ])
 ])
+])
 
 # sles10 sp2 need 5 parameter for vfs_symlink
 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
@@ -1860,6 +1866,39 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# 2.6.32 without DQUOT_INIT defined.
+AC_DEFUN([LC_DQUOT_INIT],
+[AC_MSG_CHECKING([if DQUOT_INIT is defined])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/quotaops.h>
+],[
+        DQUOT_INIT(NULL);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_DQUOT_INIT, 1,
+                  [DQUOT_INIT is defined])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
+# 2.6.32 add a limits member in struct request_queue.
+AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
+[AC_MSG_CHECKING([if request_queue has a limits field])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/blkdev.h>
+],[
+        struct request_queue rq;
+        rq.limits.io_min = 0;
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
+                  [request_queue has a limits field])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
 #
 # LC_PROG_LINUX
 #
@@ -1913,7 +1952,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_FUNC_RCU
          LC_PERCPU_COUNTER
          LC_TASK_CLENV_STORE
-         LC_QUOTA64
          LC_4ARGS_VFS_SYMLINK
 
          # does the kernel have VFS intent patches?
@@ -2013,6 +2051,17 @@ AC_DEFUN([LC_PROG_LINUX],
 
          # 2.6.31
          LC_BLK_QUEUE_LOG_BLK_SIZE
+
+         # 2.6.32
+         LC_DQUOT_INIT
+         LC_REQUEST_QUEUE_LIMITS
+
+         #
+         if test x$enable_server = xyes ; then
+                if test x$enable_quota_module = xyes ; then
+                        LC_QUOTA64    # must after LC_HAVE_QUOTAIO_V1_H
+                fi
+         fi
 ])
 
 #
@@ -2319,26 +2368,25 @@ LB_LINUX_TRY_COMPILE([
 # LC_QUOTA64
 # linux kernel have 64-bit limits support
 #
-AC_DEFUN([LC_QUOTA64],
-[if test x$enable_quota_module = xyes -a x$enable_server = xyes ; then
+AC_DEFUN([LC_QUOTA64],[
         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-I$LINUX/fs"
         LB_LINUX_TRY_COMPILE([
                 #include <linux/kernel.h>
                 #include <linux/fs.h>
-                #include <linux/quotaio_v2.h>
+                #ifdef HAVE_QUOTAIO_V1_H
+                # include <linux/quotaio_v2.h>
                 int versions[] = V2_INITQVERSIONS_R1;
                 struct v2_disk_dqblk_r1 dqblk_r1;
-        ],[],[
-                AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
-                AC_MSG_RESULT([yes])
-        ],[
-        tmp_flags="$EXTRA_KCFLAGS"
-        EXTRA_KCFLAGS="-I$LINUX/fs"
-        LB_LINUX_TRY_COMPILE([
-                #include <linux/kernel.h>
-                #include <linux/fs.h>
-                #include <quotaio_v2.h>
+                #else
+                # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H
+                #  include <quota/quotaio_v2.h>
+                # else
+                #  include <quotaio_v2.h>
+                # endif
                 struct v2r1_disk_dqblk dqblk_r1;
+                #endif
         ],[],[
                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
                 AC_MSG_RESULT([yes])
@@ -2348,9 +2396,7 @@ AC_DEFUN([LC_QUOTA64],
                 ],[])
                 AC_MSG_RESULT([no])
         ])
-        EXTRA_KCFLAGS=$tmp_flags
-        ])
-fi
+EXTRA_KCFLAGS=$tmp_flags
 ])
 
 # LC_SECURITY_PLUG  # for SLES10 SP2
index dcf399a..d2b3f80 100644 (file)
@@ -797,5 +797,13 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount)
 #define blk_queue_logical_block_size(q, sz) blk_queue_hardsect_size(q, sz)
 #endif
 
+#ifdef HAVE_DQUOT_INIT
+# define ll_vfs_dq_init DQUOT_INIT
+# define ll_vfs_dq_drop DQUOT_DROP
+#else
+# define ll_vfs_dq_init vfs_dq_init
+# define ll_vfs_dq_drop vfs_dq_drop
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index a0619f8..05daf03 100644 (file)
@@ -2428,7 +2428,7 @@ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
                 return -EROFS;
         if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
                 return -EACCES;
-        if (current->fsuid == inode->i_uid) {
+        if (cfs_curproc_fsuid() == inode->i_uid) {
                 mode >>= 6;
         } else if (1) {
                 if (((mode >> 3) & mask & S_IRWXO) != mask)
index 49347fa..85f4a1a 100644 (file)
 #ifdef HAVE_QUOTAIO_V1_H
 # include <linux/quotaio_v1.h>
 # include <linux/quotaio_v2.h>
+#elif defined(HAVE_FS_QUOTA_QUOTAIO_V1_H)
+# include <quota/quotaio_v1.h>
+# include <quota/quotaio_v2.h>
+# include <quota/quota_tree.h>
+# define V2_DQTREEOFF    QT_TREEOFF
 #else
 # include <quotaio_v1.h>
 # include <quotaio_v2.h>
@@ -869,6 +874,14 @@ static int fsfilt_ext3_sync(struct super_block *sb)
                         ext3_ext_walk_space(tree, block, num, cb);
 #endif
 
+#ifdef EXT_INSERT_EXTENT_WITH_5ARGS
+#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \
+               ext3_ext_insert_extent(handle, inode, path, newext, flag)
+#else
+#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \
+               ext3_ext_insert_extent(handle, inode, path, newext)
+#endif
+
 #include <linux/lustre_version.h>
 
 struct bpointers {
@@ -1480,7 +1493,7 @@ static int fsfilt_ext3_quotactl(struct super_block *sb,
                                 struct obd_quotactl *oqc)
 {
         int i, rc = 0, error = 0;
-        struct quotactl_ops *qcop;
+        const struct quotactl_ops *qcop;
         struct if_dqinfo *info;
         struct if_dqblk *dqblk;
         ENTRY;
@@ -1880,7 +1893,7 @@ static int create_new_quota_files(struct qchk_ctxt *qctxt,
                         GOTO(out, rc = -EINVAL);
                 }
 
-                DQUOT_DROP(file->f_dentry->d_inode);
+                ll_vfs_dq_drop(file->f_dentry->d_inode);
 
                 rc = v3_write_dqheader(file, i);
                 if (rc) {
index 223aeb1..3ab77d8 100644 (file)
@@ -89,7 +89,7 @@ int class_dentry_readdir(struct obd_device *obd, struct dentry *dir,
                 GOTO(out_pop, rc = PTR_ERR(mnt));
         }
 
-        file = dentry_open(dentry, mnt, O_RDONLY);
+        file = ll_dentry_open(dentry, mnt, O_RDONLY, current_cred());
         if (IS_ERR(file))
                 /* dentry_open_it() drops the dentry, mnt refs */
                 GOTO(out_pop, rc = PTR_ERR(file));
index 3d11179..bff5eba 100644 (file)
@@ -1561,7 +1561,7 @@ int filter_vfs_unlink(struct inode *dir, struct dentry *dentry,
                 GOTO(out, rc = -EPERM);
 
         /* check_sticky() */
-        if ((dentry->d_inode->i_uid != current->fsuid &&
+        if ((dentry->d_inode->i_uid != cfs_curproc_fsuid() &&
              !cfs_capable(CFS_CAP_FOWNER)) || IS_APPEND(dentry->d_inode) ||
             IS_IMMUTABLE(dentry->d_inode))
                 GOTO(out, rc = -EPERM);
@@ -1569,7 +1569,7 @@ int filter_vfs_unlink(struct inode *dir, struct dentry *dentry,
         /* NOTE: This might need to go outside i_mutex, though it isn't clear if
          *       that was done because of journal_start (which is already done
          *       here) or some other ordering issue. */
-        DQUOT_INIT(dir);
+        ll_vfs_dq_init(dir);
 
         rc = ll_security_inode_unlink(dir, dentry, mnt);
         if (rc)
@@ -3187,7 +3187,7 @@ int filter_setattr_internal(struct obd_export *exp, struct dentry *dentry,
         }
         if (ia_valid & (ATTR_SIZE | ATTR_UID | ATTR_GID)) {
                 unsigned long now = jiffies;
-                DQUOT_INIT(inode);
+                ll_vfs_dq_init(inode);
                 /* Filter truncates and writes are serialized by
                  * i_alloc_sem, see the comment in
                  * filter_preprw_write.*/
@@ -4073,7 +4073,7 @@ int filter_destroy(struct obd_export *exp, struct obdo *oa,
                 if (fcc != NULL)
                         *fcc = oa->o_lcookie;
         }
-        DQUOT_INIT(dchild->d_inode);
+        ll_vfs_dq_init(dchild->d_inode);
 
         /* we're gonna truncate it first in order to avoid possible deadlock:
          *      P1                      P2
index 38ac245..9440cb1 100644 (file)
@@ -675,7 +675,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa,
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         cleanup_phase = 2;
 
-        DQUOT_INIT(inode);
+        ll_vfs_dq_init(inode);
         fsfilt_check_slow(obd, now, "quota init");
 
         LOCK_INODE_MUTEX(inode);
index 3bdcaf9..3645cdc 100644 (file)
@@ -213,23 +213,32 @@ static inline void
 osd_push_ctxt(const struct lu_env *env, struct osd_ctxt *save)
 {
         struct md_ucred    *uc = md_ucred(env);
+        struct cred        *tc;
 
         LASSERT(uc != NULL);
 
-        save->oc_uid = current->fsuid;
-        save->oc_gid = current->fsgid;
-        save->oc_cap = current->cap_effective;
-        current->fsuid         = uc->mu_fsuid;
-        current->fsgid         = uc->mu_fsgid;
-        current->cap_effective = uc->mu_cap;
+        save->oc_uid = current_fsuid();
+        save->oc_gid = current_fsgid();
+        save->oc_cap = current_cap();
+        if ((tc = prepare_creds())) {
+                tc->fsuid         = uc->mu_fsuid;
+                tc->fsgid         = uc->mu_fsgid;
+                tc->cap_effective = uc->mu_cap;
+                commit_creds(tc);
+        }
 }
 
 static inline void
 osd_pop_ctxt(struct osd_ctxt *save)
 {
-        current->fsuid         = save->oc_uid;
-        current->fsgid         = save->oc_gid;
-        current->cap_effective = save->oc_cap;
+        struct cred *tc;
+
+        if ((tc = prepare_creds())) {
+                tc->fsuid         = save->oc_uid;
+                tc->fsgid         = save->oc_gid;
+                tc->cap_effective = save->oc_cap;
+                commit_creds(tc);
+        }
 }
 #endif