])
])
-# 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],
])
])
+# 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
#
LC_FUNC_RCU
LC_PERCPU_COUNTER
LC_TASK_CLENV_STORE
- LC_QUOTA64
LC_4ARGS_VFS_SYMLINK
# does the kernel have VFS intent patches?
# 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
])
#
# 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])
],[])
AC_MSG_RESULT([no])
])
- EXTRA_KCFLAGS=$tmp_flags
- ])
-fi
+EXTRA_KCFLAGS=$tmp_flags
])
# LC_SECURITY_PLUG # for SLES10 SP2
#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 */
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)
#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>
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 {
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;
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) {
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));
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);
/* 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)
}
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.*/
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
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);
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