[Pkg-lustre-svn-commit] r490 - in /trunk/debian: TODO changelog patches/bug_15949_mds.body_capacity.dpatch
winnie at users.alioth.debian.org
winnie at users.alioth.debian.org
Fri Sep 12 07:26:36 UTC 2008
Author: winnie
Date: Fri Sep 12 07:26:36 2008
New Revision: 490
URL: http://svn.debian.org/wsvn/pkg-lustre/?sc=1&rev=490
Log:
Fix some issues
Added:
trunk/debian/patches/bug_15949_mds.body_capacity.dpatch
Modified:
trunk/debian/TODO
trunk/debian/changelog
Modified: trunk/debian/TODO
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/TODO?rev=490&op=diff
==============================================================================
--- trunk/debian/TODO (original)
+++ trunk/debian/TODO Fri Sep 12 07:26:36 2008
@@ -5,47 +5,8 @@
- llobdstat
- all lc_* programms at once (maybe one and link al other to this one)
+- Replace obsolete build-dep tetex-extra with something from texlive-*
-- I've had a look into the cfs bugzilla and this are bugs with patch arround
- (which is landed in a future release, we should include most of them into our
- package i think)
-
- Here is the list:
- - 5491 & 11880 (this patchset doesn't work properly right now)
- - 5494
- - 6334
- - 12207
- - 12411
- - 12460
- - 12609
- - 12616
- - 13164
- - 13518 (update of kernel patches)
- - 13616 (update of kernel patches)
- - 13632
- - 13693 (?)
- - 13696
- - 13720 (?)
- - 13748 (update of kernel patches)
- - 13751
- - 13852
-
- And here is the list of bugs which (i think) we should have fixed, but there is no patch available
- in the bugzilla:
-
- - 11990
- - 7312
- - 10718
- - 13521
- - 13570
- - 13594
- - 13608
- - 13626
- - 13723
- - 13766
- - 13767
- - 13803
- - 13853
-- Patrick Winnertz <winnie at debian.org> Thu, 17 Jan 2008 13:09:05 +0200
Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/changelog?rev=490&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Fri Sep 12 07:26:36 2008
@@ -1,9 +1,10 @@
-lustre (1.6.5.1-0.credativ.etch.3) unstable; urgency=low
-
- * Backport to etch.
- * Add patch from bugzilla to fix 101 Error msg.
+lustre (1.6.5.1-2) unstable; urgency=low
+
+ * Add patch from bugzilla to fix 101 Error msg. This issue
+ is only around if using 1.6.4.x servers and 1.6.5.x clients
+ (Or vice versa)
* Added patch from bugzilla to prevent kernel oops when
- ost disk is ~70% full
+ ost disk is ~70% full. - Doesn't work yet
-- Patrick Winnertz <winnie at debian.org> Mon, 08 Sep 2008 20:51:21 +0200
Added: trunk/debian/patches/bug_15949_mds.body_capacity.dpatch
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/bug_15949_mds.body_capacity.dpatch?rev=490&op=file
==============================================================================
--- trunk/debian/patches/bug_15949_mds.body_capacity.dpatch (added)
+++ trunk/debian/patches/bug_15949_mds.body_capacity.dpatch Fri Sep 12 07:26:36 2008
@@ -1,0 +1,1431 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## bug_15949_mds.body_capacity.dpatch by Patrick Winnertz <winnie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch from bug 15949 (should be closed in 1.6.6)
+
+ at DPATCH@
+diff -u -p -r1.2 curproc.h
+--- libcfs/include/libcfs/curproc.h 27 Jul 2008 21:22:56 -0000 1.2
++++ libcfs/include/libcfs/curproc.h 1 Sep 2008 15:26:52 -0000
+@@ -70,10 +70,29 @@ char *cfs_curproc_comm(void);
+ *
+ * cfs_kernel_cap_t
+ */
+-cfs_kernel_cap_t cfs_curproc_cap_get(void);
+-void cfs_curproc_cap_set(cfs_kernel_cap_t cap);
+ #endif
+
++typedef __u32 cfs_cap_t;
++
++#define CFS_CAP_CHOWN 0
++#define CFS_CAP_DAC_OVERRIDE 1
++#define CFS_CAP_DAC_READ_SEARCH 2
++#define CFS_CAP_FOWNER 3
++#define CFS_CAP_FSETID 4
++#define CFS_CAP_LINUX_IMMUTABLE 9
++#define CFS_CAP_SYS_ADMIN 21
++#define CFS_CAP_SYS_BOOT 23
++#define CFS_CAP_SYS_RESOURCE 24
++
++#define CFS_CAP_FS_MASK 0x1a0021f
++
++void cfs_cap_raise(cfs_cap_t cap);
++void cfs_cap_lower(cfs_cap_t cap);
++int cfs_cap_raised(cfs_cap_t cap);
++cfs_cap_t cfs_curproc_cap_pack(void);
++void cfs_curproc_cap_unpack(cfs_cap_t cap);
++int cfs_capable(cfs_cap_t cap);
++
+ /* __LIBCFS_CURPROC_H__ */
+ #endif
+ /*
+Index: libcfs/include/libcfs/darwin/darwin-prim.h
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/include/libcfs/darwin/darwin-prim.h,v
+retrieving revision 1.2
+diff -u -p -r1.2 darwin-prim.h
+--- libcfs/include/libcfs/darwin/darwin-prim.h 27 Jul 2008 21:22:57 -0000 1.2
++++ libcfs/include/libcfs/darwin/darwin-prim.h 1 Sep 2008 15:26:52 -0000
+@@ -438,10 +438,6 @@ extern int is_suser(void);
+ #define lock_kernel() do {} while(0)
+ #define unlock_kernel() do {} while(0)
+
+-#define CAP_SYS_BOOT 0
+-#define CAP_SYS_ADMIN 1
+-#define capable(a) ((a) == CAP_SYS_BOOT ? is_suser(): is_suser1())
+-
+ #define USERMODEHELPER(path, argv, envp) (0)
+
+ #define cfs_module(name, version, init, fini) \
+Index: libcfs/include/libcfs/darwin/libcfs.h
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/include/libcfs/darwin/libcfs.h,v
+retrieving revision 1.2
+diff -u -p -r1.2 libcfs.h
+--- libcfs/include/libcfs/darwin/libcfs.h 27 Jul 2008 21:22:57 -0000 1.2
++++ libcfs/include/libcfs/darwin/libcfs.h 1 Sep 2008 15:26:52 -0000
+@@ -203,7 +203,7 @@ __entry_nesting(&__cdd);
+ /*
+ * XNU has no capabilities
+ */
+-typedef int cfs_kernel_cap_t;
++typedef __u32 cfs_kernel_cap_t;
+
+ #ifdef __KERNEL__
+ enum {
+Index: libcfs/include/libcfs/winnt/winnt-prim.h
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/include/libcfs/winnt/winnt-prim.h,v
+retrieving revision 1.2
+diff -u -p -r1.2 winnt-prim.h
+--- libcfs/include/libcfs/winnt/winnt-prim.h 27 Jul 2008 21:22:59 -0000 1.2
++++ libcfs/include/libcfs/winnt/winnt-prim.h 1 Sep 2008 15:26:52 -0000
+@@ -709,11 +709,6 @@ libcfs_arch_cleanup(void);
+ #define lock_kernel() do {} while(0)
+ #define unlock_kernel() do {} while(0)
+
+-#define CAP_SYS_ADMIN 0
+-#define CAP_SYS_ROOT 1
+-
+-#define capable(a) (TRUE)
+-
+ #define USERMODEHELPER(path, argv, envp) (0)
+
+
+Index: libcfs/libcfs/lwt.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/lwt.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 lwt.c
+--- libcfs/libcfs/lwt.c 27 Jul 2008 21:23:00 -0000 1.3
++++ libcfs/libcfs/lwt.c 1 Sep 2008 15:26:52 -0000
+@@ -86,7 +86,7 @@ lwt_lookup_string (int *size, char *knl_
+ * trying to determine the string length, so we're trusting our
+ * caller... */
+
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ return (-EPERM);
+
+ if (user_size > 0 &&
+@@ -117,7 +117,7 @@ lwt_control (int enable, int clear)
+ int i;
+ int j;
+
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ return (-EPERM);
+
+ if (!enable) {
+@@ -164,7 +164,7 @@ lwt_snapshot (cycles_t *now, int *ncpu,
+ int i;
+ int j;
+
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ return (-EPERM);
+
+ *ncpu = num_online_cpus();
+Index: libcfs/libcfs/darwin/darwin-curproc.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/darwin/darwin-curproc.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 darwin-curproc.c
+--- libcfs/libcfs/darwin/darwin-curproc.c 27 Jul 2008 21:23:01 -0000 1.3
++++ libcfs/libcfs/darwin/darwin-curproc.c 1 Sep 2008 15:26:52 -0000
+@@ -163,16 +163,25 @@ char *cfs_curproc_comm(void)
+ #endif
+ }
+
+-cfs_kernel_cap_t cfs_curproc_cap_get(void)
++void cfs_cap_raise(cfs_cap_t cap) {}
++void cfs_cap_lower(cfs_cap_t cap) {}
++
++int cfs_cap_raised(cfs_cap_t cap)
+ {
++ return 1;
++}
++
++cfs_cap_t cfs_curproc_cap_pack(void) {
+ return -1;
+ }
+
+-void cfs_curproc_cap_set(cfs_kernel_cap_t cap)
+-{
+- return;
++void cfs_curproc_cap_unpack(cfs_cap_t cap) {
+ }
+
++int cfs_capable(cfs_cap_t cap)
++{
++ return cap == CFS_CAP_SYS_BOOT ? is_suser(): is_suser1();
++}
+
+ /*
+ * Local variables:
+Index: libcfs/libcfs/linux/linux-curproc.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/linux/linux-curproc.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 linux-curproc.c
+--- libcfs/libcfs/linux/linux-curproc.c 27 Jul 2008 21:23:02 -0000 1.3
++++ libcfs/libcfs/linux/linux-curproc.c 1 Sep 2008 15:26:52 -0000
+@@ -120,14 +120,48 @@ char *cfs_curproc_comm(void)
+ return current->comm;
+ }
+
+-cfs_kernel_cap_t cfs_curproc_cap_get(void)
++/* Currently all the CFS_CAP_* defines match CAP_* ones. */
++#define cfs_cap_pack(cap) (cap)
++#define cfs_cap_unpack(cap) (cap)
++
++void cfs_cap_raise(cfs_cap_t cap)
++{
++ cap_raise(cfs_current()->cap_effective, cfs_cap_unpack(cap));
++}
++
++void cfs_cap_lower(cfs_cap_t cap)
+ {
+- return current->cap_effective;
++ cap_lower(cfs_current()->cap_effective, cfs_cap_unpack(cap));
++}
++
++int cfs_cap_raised(cfs_cap_t cap)
++{
++ return cap_raised(cfs_current()->cap_effective, cfs_cap_unpack(cap));
++}
++
++cfs_cap_t cfs_curproc_cap_pack(void) {
++#if _LINUX_CAPABILITY_VERSION == 0x19980330
++ return cfs_cap_pack(current->cap_effective);
++#elif _LINUX_CAPABILITY_VERSION == 0x20071026
++ return cfs_cap_pack(current->cap_effective[0]);
++#else
++ #error "need correct _LINUX_CAPABILITY_VERSION "
++#endif
++}
++
++void cfs_curproc_cap_unpack(cfs_cap_t cap) {
++#if _LINUX_CAPABILITY_VERSION == 0x19980330
++ current->cap_effective = cfs_cap_unpack(cap);
++#elif _LINUX_CAPABILITY_VERSION == 0x20071026
++ current->cap_effective[0] = cfs_cap_unpack(cap);
++#else
++ #error "need correct _LINUX_CAPABILITY_VERSION "
++#endif
+ }
+
+-void cfs_curproc_cap_set(cfs_kernel_cap_t cap)
++int cfs_capable(cfs_cap_t cap)
+ {
+- current->cap_effective = cap;
++ return capable(cfs_cap_unpack(cap));
+ }
+
+ EXPORT_SYMBOL(cfs_curproc_uid);
+@@ -140,8 +174,12 @@ EXPORT_SYMBOL(cfs_curproc_comm);
+ EXPORT_SYMBOL(cfs_curproc_groups_nr);
+ EXPORT_SYMBOL(cfs_curproc_groups_dump);
+ EXPORT_SYMBOL(cfs_curproc_is_in_groups);
+-EXPORT_SYMBOL(cfs_curproc_cap_get);
+-EXPORT_SYMBOL(cfs_curproc_cap_set);
++EXPORT_SYMBOL(cfs_cap_raise);
++EXPORT_SYMBOL(cfs_cap_lower);
++EXPORT_SYMBOL(cfs_cap_raised);
++EXPORT_SYMBOL(cfs_curproc_cap_pack);
++EXPORT_SYMBOL(cfs_curproc_cap_unpack);
++EXPORT_SYMBOL(cfs_capable);
+
+ /*
+ * Local variables:
+Index: libcfs/libcfs/linux/linux-module.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/linux/linux-module.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 linux-module.c
+--- libcfs/libcfs/linux/linux-module.c 27 Jul 2008 21:23:02 -0000 1.3
++++ libcfs/libcfs/linux/linux-module.c 1 Sep 2008 15:26:52 -0000
+@@ -157,7 +157,7 @@ libcfs_ioctl(struct inode *inode, struct
+ panic("debugctl-invoked panic");
+ return (0);
+ case IOC_LIBCFS_MEMHOG:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ return -EPERM;
+ /* go thought */
+ }
+Index: libcfs/libcfs/winnt/winnt-curproc.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/winnt/winnt-curproc.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 winnt-curproc.c
+--- libcfs/libcfs/winnt/winnt-curproc.c 27 Jul 2008 21:23:03 -0000 1.3
++++ libcfs/libcfs/winnt/winnt-curproc.c 1 Sep 2008 15:26:53 -0000
+@@ -106,16 +106,33 @@ char *cfs_curproc_comm(void)
+ return this_task.comm;
+ }
+
+-cfs_kernel_cap_t cfs_curproc_cap_get(void)
++void cfs_cap_raise(cfs_cap_t cap)
+ {
+- return this_task.cap_effective;
++ this_task.cap_effective |= (1 << cap);
+ }
+
+-void cfs_curproc_cap_set(cfs_kernel_cap_t cap)
++void cfs_cap_lower(cfs_cap_t cap)
+ {
+- this_task.cap_effective = cap;
++ this_task.cap_effective &= ~(1 << cap);
+ }
+
++int cfs_cap_raised(cfs_cap_t cap)
++{
++ return this_task.cap_effective & (1 << cap);
++}
++
++cfs_cap_t cfs_curproc_cap_pack(void) {
++ return this_task.cap_effective;
++}
++
++void cfs_curproc_cap_unpack(cfs_cap_t cap) {
++ this_task.cap_effective = cap;
++}
++
++int cfs_capable(cfs_cap_t cap)
++{
++ return TRUE;
++}
+
+ /*
+ * Implementation of linux task management routines
+@@ -468,5 +485,9 @@ EXPORT_SYMBOL(cfs_curproc_comm);
+ EXPORT_SYMBOL(cfs_curproc_groups_nr);
+ EXPORT_SYMBOL(cfs_curproc_groups_dump);
+ EXPORT_SYMBOL(cfs_curproc_is_in_groups);
+-EXPORT_SYMBOL(cfs_curproc_cap_get);
+-EXPORT_SYMBOL(cfs_curproc_cap_set);
++EXPORT_SYMBOL(cfs_cap_raise);
++EXPORT_SYMBOL(cfs_cap_lower);
++EXPORT_SYMBOL(cfs_cap_raised);
++EXPORT_SYMBOL(cfs_curproc_cap_pack);
++EXPORT_SYMBOL(cfs_curproc_cap_unpack);
++EXPORT_SYMBOL(cfs_capable);
+Index: libcfs/libcfs/winnt/winnt-module.c
+===================================================================
+RCS file: /cvsroot/cfs/libcfs/libcfs/winnt/winnt-module.c,v
+retrieving revision 1.3
+diff -u -p -r1.3 winnt-module.c
+--- libcfs/libcfs/winnt/winnt-module.c 27 Jul 2008 21:23:04 -0000 1.3
++++ libcfs/libcfs/winnt/winnt-module.c 1 Sep 2008 15:26:53 -0000
+@@ -145,7 +145,7 @@ libcfs_ioctl(cfs_file_t * file, unsigned
+ return (0);
+ case IOC_LIBCFS_MEMHOG:
+
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ return -EPERM;
+ break;
+ }
+Index: lustre/cmm/mdc_object.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/cmm/mdc_object.c,v
+retrieving revision 1.5
+diff -u -p -r1.5 mdc_object.c
+--- lustre/cmm/mdc_object.c 27 Jul 2008 21:23:48 -0000 1.5
++++ lustre/cmm/mdc_object.c 1 Sep 2008 15:26:53 -0000
+@@ -293,7 +293,7 @@ static int mdc_attr_set(const struct lu_
+ } else {
+ mci->mci_opdata.op_fsuid = la->la_uid;
+ mci->mci_opdata.op_fsgid = la->la_gid;
+- mci->mci_opdata.op_cap = current->cap_effective;
++ mci->mci_opdata.op_cap = cfs_curproc_cap_pack();
+ mci->mci_opdata.op_suppgids[0] =
+ mci->mci_opdata.op_suppgids[1] = -1;
+ }
+@@ -319,7 +319,7 @@ static int mdc_object_create(const struc
+ int rc, symlen;
+ uid_t uid;
+ gid_t gid;
+- __u32 cap;
++ cfs_cap_t cap;
+ ENTRY;
+
+ LASSERT(S_ISDIR(la->la_mode));
+@@ -415,7 +415,7 @@ static int mdc_ref_add(const struct lu_e
+ } else {
+ mci->mci_opdata.op_fsuid = la->la_uid;
+ mci->mci_opdata.op_fsgid = la->la_gid;
+- mci->mci_opdata.op_cap = current->cap_effective;
++ mci->mci_opdata.op_cap = cfs_curproc_cap_pack();
+ mci->mci_opdata.op_suppgids[0] =
+ mci->mci_opdata.op_suppgids[1] = -1;
+ }
+@@ -459,7 +459,7 @@ static int mdc_ref_del(const struct lu_e
+ } else {
+ mci->mci_opdata.op_fsuid = la->la_uid;
+ mci->mci_opdata.op_fsgid = la->la_gid;
+- mci->mci_opdata.op_cap = current->cap_effective;
++ mci->mci_opdata.op_cap = cfs_curproc_cap_pack();
+ mci->mci_opdata.op_suppgids[0] = -1;
+ }
+
+@@ -535,7 +535,7 @@ static int mdc_rename_tgt(const struct l
+ } else {
+ mci->mci_opdata.op_fsuid = la->la_uid;
+ mci->mci_opdata.op_fsgid = la->la_gid;
+- mci->mci_opdata.op_cap = current->cap_effective;
++ mci->mci_opdata.op_cap = cfs_curproc_cap_pack();
+ mci->mci_opdata.op_suppgids[0] =
+ mci->mci_opdata.op_suppgids[1] = -1;
+ }
+Index: lustre/include/liblustre.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/liblustre.h,v
+retrieving revision 1.66
+diff -u -p -r1.66 liblustre.h
+--- lustre/include/liblustre.h 27 Jul 2008 21:23:57 -0000 1.66
++++ lustre/include/liblustre.h 1 Sep 2008 15:26:53 -0000
+@@ -589,13 +589,6 @@ typedef struct task_struct cfs_task_t;
+
+ extern struct task_struct *current;
+ int in_group_p(gid_t gid);
+-static inline int capable(int cap)
+-{
+- if (current->cap_effective & (1 << cap))
+- return 1;
+- else
+- return 0;
+-}
+
+ #define set_current_state(foo) do { current->state = foo; } while (0)
+
+@@ -769,12 +762,6 @@ typedef enum {
+ CAP_SET=1
+ } cap_flag_value_t;
+
+-#define CAP_DAC_OVERRIDE 1
+-#define CAP_DAC_READ_SEARCH 2
+-#define CAP_FOWNER 3
+-#define CAP_FSETID 4
+-#define CAP_SYS_ADMIN 21
+-
+ cap_t cap_get_proc(void);
+ int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
+
+Index: lustre/include/lustre_log.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/lustre_log.h,v
+retrieving revision 1.7
+diff -u -p -r1.7 lustre_log.h
+--- lustre/include/lustre_log.h 27 Jul 2008 21:24:01 -0000 1.7
++++ lustre/include/lustre_log.h 1 Sep 2008 15:26:53 -0000
+@@ -237,14 +237,6 @@ struct llog_ctxt {
+ void *llog_proc_cb;
+ };
+
+-#ifndef __KERNEL__
+-
+-#define cap_raise(c, flag) do {} while(0)
+-
+-#define CAP_SYS_RESOURCE 24
+-
+-#endif /* !__KERNEL__ */
+-
+ static inline void llog_gen_init(struct llog_ctxt *ctxt)
+ {
+ struct obd_device *obd = ctxt->loc_exp->exp_obd;
+@@ -392,8 +384,7 @@ static inline int llog_write_rec(struct
+ int numcookies, void *buf, int idx)
+ {
+ struct llog_operations *lop;
+- __u32 cap;
+- int rc, buflen;
++ int raised, rc, buflen;
+ ENTRY;
+
+ rc = llog_handle2ops(handle, &lop);
+@@ -410,10 +401,12 @@ static inline int llog_write_rec(struct
+ buflen = rec->lrh_len;
+ LASSERT(size_round(buflen) == buflen);
+
+- cap = current->cap_effective;
+- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
++ raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
++ if (!raised)
++ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+ rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
+- current->cap_effective = cap;
++ if (!raised)
++ cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+ RETURN(rc);
+ }
+
+@@ -509,8 +502,7 @@ static inline int llog_create(struct llo
+ struct llog_logid *logid, char *name)
+ {
+ struct llog_operations *lop;
+- __u32 cap;
+- int rc;
++ int raised, rc;
+ ENTRY;
+
+ rc = llog_obd2ops(ctxt, &lop);
+@@ -519,10 +511,12 @@ static inline int llog_create(struct llo
+ if (lop->lop_create == NULL)
+ RETURN(-EOPNOTSUPP);
+
+- cap = current->cap_effective;
+- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
++ raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
++ if (!raised)
++ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+ rc = lop->lop_create(ctxt, res, logid, name);
+- current->cap_effective = cap;
++ if (!raised)
++ cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+ RETURN(rc);
+ }
+
+Index: lustre/include/md_object.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/md_object.h,v
+retrieving revision 1.8
+diff -u -p -r1.8 md_object.h
+--- lustre/include/md_object.h 27 Jul 2008 21:24:04 -0000 1.8
++++ lustre/include/md_object.h 1 Sep 2008 15:26:53 -0000
+@@ -81,7 +81,7 @@ struct md_ucred {
+ __u32 mu_fsuid;
+ __u32 mu_fsgid;
+ __u32 mu_suppgids[2];
+- __u32 mu_cap;
++ cfs_cap_t mu_cap;
+ __u32 mu_umask;
+ struct group_info *mu_ginfo;
+ struct md_identity *mu_identity;
+Index: lustre/include/obd.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/obd.h,v
+retrieving revision 1.53
+diff -u -p -r1.53 obd.h
+--- lustre/include/obd.h 27 Jul 2008 21:24:04 -0000 1.53
++++ lustre/include/obd.h 1 Sep 2008 15:26:53 -0000
+@@ -1092,7 +1092,7 @@ struct md_op_data {
+ __u32 op_suppgids[2];
+ __u32 op_fsuid;
+ __u32 op_fsgid;
+- __u32 op_cap;
++ cfs_cap_t op_cap;
+ void *op_data;
+
+ /* iattr fields and blocks. */
+@@ -1397,7 +1397,7 @@ struct md_ops {
+ int (*m_close)(struct obd_export *, struct md_op_data *,
+ struct md_open_data *, struct ptlrpc_request **);
+ int (*m_create)(struct obd_export *, struct md_op_data *,
+- const void *, int, int, __u32, __u32, __u32,
++ const void *, int, int, __u32, __u32, cfs_cap_t,
+ __u64, struct ptlrpc_request **);
+ int (*m_done_writing)(struct obd_export *, struct md_op_data *,
+ struct md_open_data *);
+Index: lustre/include/obd_class.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/obd_class.h,v
+retrieving revision 1.27
+diff -u -p -r1.27 obd_class.h
+--- lustre/include/obd_class.h 27 Jul 2008 21:24:05 -0000 1.27
++++ lustre/include/obd_class.h 1 Sep 2008 15:26:53 -0000
+@@ -1841,7 +1841,7 @@ static inline int md_close(struct obd_ex
+
+ static inline int md_create(struct obd_export *exp, struct md_op_data *op_data,
+ const void *data, int datalen, int mode, __u32 uid,
+- __u32 gid, __u32 cap_effective, __u64 rdev,
++ __u32 gid, cfs_cap_t cap_effective, __u64 rdev,
+ struct ptlrpc_request **request)
+ {
+ int rc;
+Index: lustre/include/darwin/lvfs.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/darwin/lvfs.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 lvfs.h
+--- lustre/include/darwin/lvfs.h 27 Jul 2008 21:24:11 -0000 1.3
++++ lustre/include/darwin/lvfs.h 1 Sep 2008 15:26:53 -0000
+@@ -48,7 +48,7 @@
+ struct lvfs_ucred {
+ __u32 luc_fsuid;
+ __u32 luc_fsgid;
+- __u32 luc_cap;
++ cfs_kernel_cap_t luc_cap;
+ __u32 luc_uid;
+ __u32 luc_umask;
+ };
+Index: lustre/include/linux/lvfs.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/include/linux/lvfs.h,v
+retrieving revision 1.35
+diff -u -p -r1.35 lvfs.h
+--- lustre/include/linux/lvfs.h 27 Jul 2008 21:24:18 -0000 1.35
++++ lustre/include/linux/lvfs.h 1 Sep 2008 15:26:53 -0000
+@@ -62,7 +62,7 @@ struct lvfs_ucred {
+ __u32 luc_gid;
+ __u32 luc_fsuid;
+ __u32 luc_fsgid;
+- __u32 luc_cap;
++ cfs_kernel_cap_t luc_cap;
+ __u32 luc_umask;
+ struct group_info *luc_ginfo;
+ struct md_identity *luc_identity;
+Index: lustre/liblustre/lutil.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/liblustre/lutil.c,v
+retrieving revision 1.10
+diff -u -p -r1.10 lutil.c
+--- lustre/liblustre/lutil.c 27 Jul 2008 21:24:37 -0000 1.10
++++ lustre/liblustre/lutil.c 1 Sep 2008 15:26:54 -0000
+@@ -228,6 +228,34 @@ int liblustre_init_current(char *comm)
+ return 0;
+ }
+
++void cfs_cap_raise(cfs_cap_t cap)
++{
++ current->cap_effective |= (1 << cap);
++}
++
++void cfs_cap_lower(cfs_cap_t cap)
++{
++ current->cap_effective &= ~(1 << cap);
++}
++
++int cfs_cap_raised(cfs_cap_t cap)
++{
++ return current->cap_effective & (1 << cap);
++}
++
++cfs_cap_t cfs_curproc_cap_pack(void) {
++ return cfs_current()->cap_effective;
++}
++
++void cfs_curproc_cap_unpack(cfs_cap_t cap) {
++ cfs_current()->cap_effective = cap;
++}
++
++int cfs_capable(cfs_cap_t cap)
++{
++ return cfs_cap_raised(cap);
++}
++
+ int init_lib_portals()
+ {
+ int rc;
+Index: lustre/liblustre/super.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/liblustre/super.c,v
+retrieving revision 1.70
+diff -u -p -r1.70 super.c
+--- lustre/liblustre/super.c 27 Jul 2008 21:24:39 -0000 1.70
++++ lustre/liblustre/super.c 1 Sep 2008 15:26:54 -0000
+@@ -92,12 +92,12 @@ static int ll_permission(struct inode *i
+
+ if ((mask & (MAY_READ|MAY_WRITE)) ||
+ (st->st_mode & S_IXUGO))
+- if (capable(CAP_DAC_OVERRIDE))
++ if (cfs_capable(CFS_CAP_DAC_OVERRIDE))
+ return 0;
+
+ if (mask == MAY_READ ||
+ (S_ISDIR(st->st_mode) && !(mask & MAY_WRITE))) {
+- if (capable(CAP_DAC_READ_SEARCH))
++ if (cfs_capable(CFS_CAP_DAC_READ_SEARCH))
+ return 0;
+ }
+
+@@ -635,7 +635,7 @@ static int inode_setattr(struct inode *
+ st->st_ctime = attr->ia_ctime;
+ if (ia_valid & ATTR_MODE) {
+ st->st_mode = attr->ia_mode;
+- if (!in_group_p(st->st_gid) && !capable(CAP_FSETID))
++ if (!in_group_p(st->st_gid) && !cfs_capable(CFS_CAP_FSETID))
+ st->st_mode &= ~S_ISGID;
+ }
+ /* mark_inode_dirty(inode); */
+@@ -821,7 +821,7 @@ int llu_setattr_raw(struct inode *inode,
+ } else {
+ /* from inode_change_ok() */
+ if (current->fsuid != st->st_uid &&
+- !capable(CAP_FOWNER))
++ !cfs_capable(CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+ }
+ }
+@@ -979,10 +979,9 @@ static int llu_iop_symlink_raw(struct pn
+ llu_prep_md_op_data(&op_data, dir, NULL, name, len, 0,
+ LUSTRE_OPC_SYMLINK);
+
+- err = md_create(sbi->ll_md_exp, &op_data,
+- tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
+- current->fsuid, current->fsgid, current->cap_effective,
+- 0, &request);
++ err = md_create(sbi->ll_md_exp, &op_data, tgt, strlen(tgt) + 1,
++ S_IFLNK | S_IRWXUGO, current->fsuid, current->fsgid,
++ cfs_curproc_cap_pack(), 0, &request);
+ ptlrpc_req_finished(request);
+ liblustre_wait_event(0);
+ RETURN(err);
+@@ -1107,7 +1106,7 @@ static int llu_iop_mknod_raw(struct pnod
+
+ err = md_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
+ current->fsuid, current->fsgid,
+- current->cap_effective, dev, &request);
++ cfs_curproc_cap_pack(), dev, &request);
+ ptlrpc_req_finished(request);
+ break;
+ case S_IFDIR:
+@@ -1342,7 +1341,7 @@ static int llu_iop_mkdir_raw(struct pnod
+
+ err = md_create(llu_i2sbi(dir)->ll_md_exp, &op_data, NULL, 0,
+ mode | S_IFDIR, current->fsuid, current->fsgid,
+- current->cap_effective, 0, &request);
++ cfs_curproc_cap_pack(), 0, &request);
+ ptlrpc_req_finished(request);
+ liblustre_wait_event(0);
+ RETURN(err);
+Index: lustre/llite/dir.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/dir.c,v
+retrieving revision 1.112
+diff -u -p -r1.112 dir.c
+--- lustre/llite/dir.c 17 Jul 2008 17:35:03 -0000 1.112
++++ lustre/llite/dir.c 1 Sep 2008 15:26:54 -0000
+@@ -937,7 +937,7 @@ static int ll_dir_ioctl(struct inode *in
+ struct obd_quotactl *oqctl;
+ int rc, error = 0;
+
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ RETURN(-EPERM);
+
+ OBD_ALLOC_PTR(oqctl);
+@@ -961,7 +961,7 @@ static int ll_dir_ioctl(struct inode *in
+ struct if_quotacheck *check;
+ int rc;
+
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ RETURN(-EPERM);
+
+ OBD_ALLOC_PTR(check);
+@@ -1016,13 +1016,13 @@ static int ll_dir_ioctl(struct inode *in
+ case Q_QUOTAOFF:
+ case Q_SETQUOTA:
+ case Q_SETINFO:
+- if (!capable(CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO(out_quotactl, rc = -EPERM);
+ break;
+ case Q_GETQUOTA:
+ if (((type == USRQUOTA && current->euid != id) ||
+ (type == GRPQUOTA && !in_egroup_p(id))) &&
+- !capable(CAP_SYS_ADMIN))
++ !cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO(out_quotactl, rc = -EPERM);
+
+ /* XXX: dqb_valid is borrowed as a flag to mark that
+Index: lustre/llite/file.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/file.c,v
+retrieving revision 1.254
+diff -u -p -r1.254 file.c
+--- lustre/llite/file.c 27 Jul 2008 21:24:44 -0000 1.254
++++ lustre/llite/file.c 1 Sep 2008 15:26:54 -0000
+@@ -751,7 +751,7 @@ static inline void ll_remove_suid(struct
+
+ /* was any of the uid bits set? */
+ mode &= inode->i_mode;
+- if (mode && !capable(CAP_FSETID)) {
++ if (mode && !cfs_capable(CFS_CAP_FSETID)) {
+ inode->i_mode &= ~mode;
+ // XXX careful here - we cannot change the size
+ }
+@@ -1987,7 +1987,7 @@ static int ll_lov_recreate_obj(struct in
+ struct lov_stripe_md *lsm, *lsm2;
+ ENTRY;
+
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ RETURN(-EPERM);
+
+ rc = copy_from_user(&ucreatp, (struct ll_recreate_obj *)arg,
+@@ -2187,7 +2187,7 @@ static int ll_lov_setea(struct inode *in
+ int rc;
+ ENTRY;
+
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ RETURN(-EPERM);
+
+ OBD_ALLOC(lump, lum_size);
+@@ -3103,10 +3103,10 @@ check_groups:
+ check_capabilities:
+ if (!(mask & MAY_EXEC) ||
+ (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode))
+- if (capable(CAP_DAC_OVERRIDE))
++ if (cfs_capable(CFS_CAP_DAC_OVERRIDE))
+ return 0;
+
+- if (capable(CAP_DAC_READ_SEARCH) && ((mask == MAY_READ) ||
++ if (cfs_capable(CFS_CAP_DAC_READ_SEARCH) && ((mask == MAY_READ) ||
+ (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))))
+ return 0;
+
+Index: lustre/llite/llite_lib.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/llite_lib.c,v
+retrieving revision 1.177
+diff -u -p -r1.177 llite_lib.c
+--- lustre/llite/llite_lib.c 27 Jul 2008 21:24:46 -0000 1.177
++++ lustre/llite/llite_lib.c 1 Sep 2008 15:26:54 -0000
+@@ -1426,7 +1426,8 @@ int ll_setattr_raw(struct inode *inode,
+
+ /* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
+ if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
+- if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
++ if (current->fsuid != inode->i_uid &&
++ !cfs_capable(CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+ }
+
+@@ -2312,7 +2313,7 @@ struct md_op_data * ll_prep_md_op_data(s
+ op_data->op_mod_time = cfs_time_current_sec();
+ op_data->op_fsuid = current->fsuid;
+ op_data->op_fsgid = current->fsgid;
+- op_data->op_cap = current->cap_effective;
++ op_data->op_cap = cfs_curproc_cap_pack();
+ op_data->op_bias = MDS_CHECK_SPLIT;
+ op_data->op_opc = opc;
+ op_data->op_mds = 0;
+Index: lustre/llite/namei.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/namei.c,v
+retrieving revision 1.241
+diff -u -p -r1.241 namei.c
+--- lustre/llite/namei.c 27 Jul 2008 21:24:48 -0000 1.241
++++ lustre/llite/namei.c 1 Sep 2008 15:26:55 -0000
+@@ -841,7 +841,7 @@ static int ll_new_node(struct inode *dir
+
+ err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
+ current->fsuid, current->fsgid,
+- current->cap_effective, rdev, &request);
++ cfs_curproc_cap_pack(), rdev, &request);
+ ll_finish_md_op_data(op_data);
+ if (err)
+ GOTO(err_exit, err);
+Index: lustre/llite/rw.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/rw.c,v
+retrieving revision 1.170
+diff -u -p -r1.170 rw.c
+--- lustre/llite/rw.c 27 Jul 2008 21:24:49 -0000 1.170
++++ lustre/llite/rw.c 1 Sep 2008 15:26:55 -0000
+@@ -868,7 +868,7 @@ int ll_commit_write(struct file *file, s
+ if (exp == NULL)
+ RETURN(-EINVAL);
+
+- llap->llap_ignore_quota = capable(CAP_SYS_RESOURCE);
++ llap->llap_ignore_quota = cfs_capable(CFS_CAP_SYS_RESOURCE);
+
+ /*
+ * queue a write for some time in the future the first time we
+@@ -2059,7 +2059,7 @@ static int ll_file_oig_pages(struct inod
+ if (rc)
+ RETURN(rc);
+ brw_flags = OBD_BRW_SRVLOCK;
+- if (capable(CAP_SYS_RESOURCE))
++ if (cfs_capable(CFS_CAP_SYS_RESOURCE))
+ brw_flags |= OBD_BRW_NOQUOTA;
+
+ for (i = 0; i < numpages; i++) {
+Index: lustre/llite/xattr.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/llite/xattr.c,v
+retrieving revision 1.10
+diff -u -p -r1.10 xattr.c
+--- lustre/llite/xattr.c 27 Jul 2008 21:24:52 -0000 1.10
++++ lustre/llite/xattr.c 1 Sep 2008 15:26:55 -0000
+@@ -101,7 +101,7 @@ int xattr_type_filter(struct ll_sb_info
+
+ if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
+ return -EOPNOTSUPP;
+- if (xattr_type == XATTR_TRUSTED_T && !capable(CAP_SYS_ADMIN))
++ if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
+ return -EPERM;
+ if (xattr_type == XATTR_OTHER_T)
+ return -EOPNOTSUPP;
+Index: lustre/lmv/lmv_obd.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/lmv/lmv_obd.c,v
+retrieving revision 1.120
+diff -u -p -r1.120 lmv_obd.c
+--- lustre/lmv/lmv_obd.c 27 Jul 2008 21:24:56 -0000 1.120
++++ lustre/lmv/lmv_obd.c 1 Sep 2008 15:26:55 -0000
+@@ -1379,7 +1379,7 @@ cleanup:
+
+ int lmv_create(struct obd_export *exp, struct md_op_data *op_data,
+ const void *data, int datalen, int mode, __u32 uid,
+- __u32 gid, __u32 cap_effective, __u64 rdev,
++ __u32 gid, cfs_cap_t cap_effective, __u64 rdev,
+ struct ptlrpc_request **request)
+ {
+ struct obd_device *obd = exp->exp_obd;
+@@ -1898,7 +1898,7 @@ repeat:
+
+ op_data->op_fsuid = current->fsuid;
+ op_data->op_fsgid = current->fsgid;
+- op_data->op_cap = current->cap_effective;
++ op_data->op_cap = cfs_curproc_cap_pack();
+
+ tgt_exp = lmv->tgts[mds].ltd_exp;
+ if (op_data->op_namelen) {
+@@ -2022,7 +2022,7 @@ repeat:
+ request:
+ op_data->op_fsuid = current->fsuid;
+ op_data->op_fsgid = current->fsgid;
+- op_data->op_cap = current->cap_effective;
++ op_data->op_cap = cfs_curproc_cap_pack();
+
+ src_exp = lmv_get_export(lmv, mds1);
+ tgt_exp = lmv_get_export(lmv, mds2);
+@@ -2469,7 +2469,7 @@ repeat:
+
+ op_data->op_fsuid = current->fsuid;
+ op_data->op_fsgid = current->fsgid;
+- op_data->op_cap = current->cap_effective;
++ op_data->op_cap = cfs_curproc_cap_pack();
+
+ /* If child's fid is given, cancel unused locks for it if it is from
+ * another export than parent. */
+Index: lustre/lvfs/fsfilt_ext3.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/lvfs/fsfilt_ext3.c,v
+retrieving revision 1.71
+diff -u -p -r1.71 fsfilt_ext3.c
+--- lustre/lvfs/fsfilt_ext3.c 27 Jul 2008 21:25:04 -0000 1.71
++++ lustre/lvfs/fsfilt_ext3.c 1 Sep 2008 15:26:55 -0000
+@@ -523,7 +523,8 @@ static int fsfilt_ext3_setattr(struct de
+ if (iattr->ia_valid & ATTR_MODE) {
+ inode->i_mode = iattr->ia_mode;
+
+- if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
++ if (!in_group_p(inode->i_gid) &&
++ !cfs_capable(CFS_CAP_FSETID))
+ inode->i_mode &= ~S_ISGID;
+ }
+
+Index: lustre/mdc/mdc_internal.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdc/mdc_internal.h,v
+retrieving revision 1.29
+diff -u -p -r1.29 mdc_internal.h
+--- lustre/mdc/mdc_internal.h 27 Jul 2008 21:25:09 -0000 1.29
++++ lustre/mdc/mdc_internal.h 1 Sep 2008 15:26:55 -0000
+@@ -64,7 +64,7 @@ void mdc_setattr_pack(struct ptlrpc_requ
+ void *ea, int ealen, void *ea2, int ea2len);
+ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
+ const void *data, int datalen, __u32 mode, __u32 uid,
+- __u32 gid, __u32 cap_effective, __u64 rdev);
++ __u32 gid, cfs_cap_t capability, __u64 rdev);
+ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
+ __u32 mode, __u64 rdev, __u32 flags, const void *data,
+ int datalen);
+@@ -144,7 +144,8 @@ void mdc_commit_delayed(struct ptlrpc_re
+
+ int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
+ const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+- __u32 cap_effective, __u64 rdev, struct ptlrpc_request **request);
++ cfs_cap_t capability, __u64 rdev,
++ struct ptlrpc_request **request);
+ int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
+ struct ptlrpc_request **request);
+ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
+Index: lustre/mdc/mdc_lib.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdc/mdc_lib.c,v
+retrieving revision 1.35
+diff -u -p -r1.35 mdc_lib.c
+--- lustre/mdc/mdc_lib.c 27 Jul 2008 21:25:09 -0000 1.35
++++ lustre/mdc/mdc_lib.c 1 Sep 2008 15:26:55 -0000
+@@ -59,7 +59,7 @@ static void __mdc_pack_body(struct mdt_b
+ b->gid = current->gid;
+ b->fsuid = current->fsuid;
+ b->fsgid = current->fsgid;
+- b->capability = current->cap_effective;
++ b->capability = cfs_curproc_cap_pack();
+ }
+
+ void mdc_pack_capa(struct ptlrpc_request *req, const struct req_msg_field *field,
+@@ -128,7 +128,7 @@ void mdc_readdir_pack(struct ptlrpc_requ
+ /* packing of MDS records */
+ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
+ const void *data, int datalen, __u32 mode,
+- __u32 uid, __u32 gid, __u32 cap_effective, __u64 rdev)
++ __u32 uid, __u32 gid, cfs_cap_t cap_effective, __u64 rdev)
+ {
+ struct mdt_rec_create *rec;
+ char *tmp;
+@@ -218,7 +218,7 @@ void mdc_open_pack(struct ptlrpc_request
+ rec->cr_opcode = REINT_OPEN;
+ rec->cr_fsuid = current->fsuid;
+ rec->cr_fsgid = current->fsgid;
+- rec->cr_cap = current->cap_effective;
++ rec->cr_cap = cfs_curproc_cap_pack();
+ if (op_data != NULL) {
+ rec->cr_fid1 = op_data->op_fid1;
+ rec->cr_fid2 = op_data->op_fid2;
+@@ -298,7 +298,7 @@ static void mdc_setattr_pack_rec(struct
+ rec->sa_opcode = REINT_SETATTR;
+ rec->sa_fsuid = current->fsuid;
+ rec->sa_fsgid = current->fsgid;
+- rec->sa_cap = current->cap_effective;
++ rec->sa_cap = cfs_curproc_cap_pack();
+ rec->sa_suppgid = -1;
+
+ rec->sa_fid = op_data->op_fid1;
+@@ -452,7 +452,7 @@ void mdc_getattr_pack(struct ptlrpc_requ
+
+ b->fsuid = current->fsuid;
+ b->fsgid = current->fsgid;
+- b->capability = current->cap_effective;
++ b->capability = cfs_curproc_cap_pack();
+ b->valid = valid;
+ if (op_data->op_bias & MDS_CHECK_SPLIT)
+ b->valid |= OBD_MD_FLCKSPLIT;
+Index: lustre/mdc/mdc_reint.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdc/mdc_reint.c,v
+retrieving revision 1.75
+diff -u -p -r1.75 mdc_reint.c
+--- lustre/mdc/mdc_reint.c 27 Jul 2008 21:25:11 -0000 1.75
++++ lustre/mdc/mdc_reint.c 1 Sep 2008 15:26:55 -0000
+@@ -205,7 +205,8 @@ int mdc_setattr(struct obd_export *exp,
+
+ int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
+ const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+- __u32 cap_effective, __u64 rdev, struct ptlrpc_request **request)
++ cfs_cap_t cap_effective, __u64 rdev,
++ struct ptlrpc_request **request)
+ {
+ struct ptlrpc_request *req;
+ int level, rc;
+Index: lustre/mdc/mdc_request.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdc/mdc_request.c,v
+retrieving revision 1.266
+diff -u -p -r1.266 mdc_request.c
+--- lustre/mdc/mdc_request.c 27 Jul 2008 21:25:11 -0000 1.266
++++ lustre/mdc/mdc_request.c 1 Sep 2008 15:26:55 -0000
+@@ -374,7 +374,7 @@ static int mdc_xattr_common(struct obd_e
+ */
+ rec->sx_fsuid = current->fsuid;
+ rec->sx_fsgid = current->fsgid;
+- rec->sx_cap = current->cap_effective;
++ rec->sx_cap = cfs_curproc_cap_pack();
+ rec->sx_suppgid1 = suppgid;
+ rec->sx_suppgid2 = -1;
+ rec->sx_fid = *fid;
+Index: lustre/mdd/mdd_dir.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdd/mdd_dir.c,v
+retrieving revision 1.8
+diff -u -p -r1.8 mdd_dir.c
+--- lustre/mdd/mdd_dir.c 27 Jul 2008 21:25:15 -0000 1.8
++++ lustre/mdd/mdd_dir.c 1 Sep 2008 15:26:56 -0000
+@@ -359,7 +359,7 @@ static inline int mdd_is_sticky(const st
+ if (tmp_la->la_uid == uc->mu_fsuid)
+ return 0;
+
+- return !mdd_capable(uc, CAP_FOWNER);
++ return !mdd_capable(uc, CFS_CAP_FOWNER);
+ }
+
+ /*
+Index: lustre/mdd/mdd_internal.h
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdd/mdd_internal.h,v
+retrieving revision 1.9
+diff -u -p -r1.9 mdd_internal.h
+--- lustre/mdd/mdd_internal.h 27 Jul 2008 21:25:16 -0000 1.9
++++ lustre/mdd/mdd_internal.h 1 Sep 2008 15:26:56 -0000
+@@ -326,7 +326,7 @@ struct mdd_object *mdd_object_find(const
+ #define mdd_cap_raised(c, flag) (mdd_cap_t(c) & MDD_CAP_TO_MASK(flag))
+
+ /* capable() is copied from linux kernel! */
+-static inline int mdd_capable(struct md_ucred *uc, int cap)
++static inline int mdd_capable(struct md_ucred *uc, cfs_cap_t cap)
+ {
+ if (mdd_cap_raised(uc->mu_cap, cap))
+ return 1;
+Index: lustre/mdd/mdd_lov.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdd/mdd_lov.c,v
+retrieving revision 1.10
+diff -u -p -r1.10 mdd_lov.c
+--- lustre/mdd/mdd_lov.c 27 Jul 2008 21:25:16 -0000 1.10
++++ lustre/mdd/mdd_lov.c 1 Sep 2008 15:26:56 -0000
+@@ -294,7 +294,8 @@ int mdd_lsm_sanity_check(const struct lu
+ if (rc)
+ RETURN(rc);
+
+- if ((uc->mu_fsuid != tmp_la->la_uid) && !mdd_capable(uc, CAP_FOWNER))
++ if ((uc->mu_fsuid != tmp_la->la_uid) &&
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ rc = mdd_permission_internal_locked(env, obj, tmp_la,
+ MAY_WRITE);
+
+Index: lustre/mdd/mdd_object.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdd/mdd_object.c,v
+retrieving revision 1.16
+diff -u -p -r1.16 mdd_object.c
+--- lustre/mdd/mdd_object.c 27 Jul 2008 21:25:16 -0000 1.16
++++ lustre/mdd/mdd_object.c 1 Sep 2008 15:26:56 -0000
+@@ -696,7 +696,7 @@ static int mdd_fix_attr(const struct lu_
+ (LUSTRE_IMMUTABLE_FL | LUSTRE_APPEND_FL);
+
+ if ((uc->mu_fsuid != tmp_la->la_uid) &&
+- !mdd_capable(uc, CAP_FOWNER))
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+
+ /* XXX: the IMMUTABLE and APPEND_ONLY flags can
+@@ -706,7 +706,7 @@ static int mdd_fix_attr(const struct lu_
+ if (mdd_is_append(obj))
+ oldflags |= LUSTRE_APPEND_FL;
+ if ((oldflags ^ newflags) &&
+- !mdd_capable(uc, CAP_LINUX_IMMUTABLE))
++ !mdd_capable(uc, CFS_CAP_LINUX_IMMUTABLE))
+ RETURN(-EPERM);
+
+ if (!S_ISDIR(tmp_la->la_mode))
+@@ -722,7 +722,7 @@ static int mdd_fix_attr(const struct lu_
+ if ((la->la_valid & (LA_MTIME | LA_ATIME | LA_CTIME)) &&
+ !(la->la_valid & ~(LA_MTIME | LA_ATIME | LA_CTIME))) {
+ if ((uc->mu_fsuid != tmp_la->la_uid) &&
+- !mdd_capable(uc, CAP_FOWNER)) {
++ !mdd_capable(uc, CFS_CAP_FOWNER)) {
+ rc = mdd_permission_internal_locked(env, obj, tmp_la,
+ MAY_WRITE);
+ if (rc)
+@@ -736,7 +736,7 @@ static int mdd_fix_attr(const struct lu_
+ * this is for changing file with SUID or SGID. */
+ if ((la->la_valid & ~LA_MODE) &&
+ (uc->mu_fsuid != tmp_la->la_uid) &&
+- !mdd_capable(uc, CAP_FOWNER))
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+
+ if (la->la_mode == (umode_t) -1)
+@@ -746,8 +746,9 @@ static int mdd_fix_attr(const struct lu_
+ (tmp_la->la_mode & ~S_IALLUGO);
+
+ /* Also check the setgid bit! */
+- if (!lustre_in_group_p(uc, (la->la_valid & LA_GID) ? la->la_gid :
+- tmp_la->la_gid) && !mdd_capable(uc, CAP_FSETID))
++ if (!lustre_in_group_p(uc, (la->la_valid & LA_GID) ?
++ la->la_gid : tmp_la->la_gid) &&
++ !mdd_capable(uc, CFS_CAP_FSETID))
+ la->la_mode &= ~S_ISGID;
+ } else {
+ la->la_mode = tmp_la->la_mode;
+@@ -759,7 +760,7 @@ static int mdd_fix_attr(const struct lu_
+ la->la_uid = tmp_la->la_uid;
+ if (((uc->mu_fsuid != tmp_la->la_uid) ||
+ (la->la_uid != tmp_la->la_uid)) &&
+- !mdd_capable(uc, CAP_CHOWN))
++ !mdd_capable(uc, CFS_CAP_CHOWN))
+ RETURN(-EPERM);
+
+ /* If the user or group of a non-directory has been
+@@ -785,7 +786,7 @@ static int mdd_fix_attr(const struct lu_
+ if (((uc->mu_fsuid != tmp_la->la_uid) ||
+ ((la->la_gid != tmp_la->la_gid) &&
+ !lustre_in_group_p(uc, la->la_gid))) &&
+- !mdd_capable(uc, CAP_CHOWN))
++ !mdd_capable(uc, CFS_CAP_CHOWN))
+ RETURN(-EPERM);
+
+ /* Likewise, if the user or group of a non-directory
+@@ -960,7 +961,8 @@ static int mdd_xattr_sanity_check(const
+ if (rc)
+ RETURN(rc);
+
+- if ((uc->mu_fsuid != tmp_la->la_uid) && !mdd_capable(uc, CAP_FOWNER))
++ if ((uc->mu_fsuid != tmp_la->la_uid) &&
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+
+ RETURN(rc);
+@@ -1298,7 +1300,7 @@ static int mdd_open_sanity_check(const s
+ if (uc && ((uc->mu_valid == UCRED_OLD) ||
+ (uc->mu_valid == UCRED_NEW)) &&
+ (uc->mu_fsuid != tmp_la->la_uid) &&
+- !mdd_capable(uc, CAP_FOWNER))
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ RETURN(-EPERM);
+ }
+ #endif
+Index: lustre/mdd/mdd_permission.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdd/mdd_permission.c,v
+retrieving revision 1.5
+diff -u -p -r1.5 mdd_permission.c
+--- lustre/mdd/mdd_permission.c 27 Jul 2008 21:25:17 -0000 1.5
++++ lustre/mdd/mdd_permission.c 1 Sep 2008 15:26:56 -0000
+@@ -286,12 +286,12 @@ int __mdd_permission_internal(const stru
+ check_capabilities:
+ if (!(mask & MAY_EXEC) ||
+ (la->la_mode & S_IXUGO) || S_ISDIR(la->la_mode))
+- if (mdd_capable(uc, CAP_DAC_OVERRIDE))
++ if (mdd_capable(uc, CFS_CAP_DAC_OVERRIDE))
+ RETURN(0);
+
+ if ((mask == MAY_READ) ||
+ (S_ISDIR(la->la_mode) && !(mask & MAY_WRITE)))
+- if (mdd_capable(uc, CAP_DAC_READ_SEARCH))
++ if (mdd_capable(uc, CFS_CAP_DAC_READ_SEARCH))
+ RETURN(0);
+
+ RETURN(-EACCES);
+@@ -392,7 +392,8 @@ int mdd_permission(const struct lu_env *
+ RETURN(rc);
+ }
+
+- if (la->la_uid != uc->mu_fsuid && !mdd_capable(uc, CAP_FOWNER))
++ if (la->la_uid != uc->mu_fsuid &&
++ !mdd_capable(uc, CFS_CAP_FOWNER))
+ rc = -EPERM;
+ }
+
+Index: lustre/mdt/mdt_lib.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/mdt/mdt_lib.c,v
+retrieving revision 1.13
+diff -u -p -r1.13 mdt_lib.c
+--- lustre/mdt/mdt_lib.c 27 Jul 2008 21:25:24 -0000 1.13
++++ lustre/mdt/mdt_lib.c 1 Sep 2008 15:26:56 -0000
+@@ -243,7 +243,7 @@ static int new_init_ucred(struct mdt_thr
+
+ /* remove fs privilege for non-root user */
+ if (ucred->mu_fsuid)
+- ucred->mu_cap = pud->pud_cap & ~CAP_FS_MASK;
++ ucred->mu_cap = pud->pud_cap & ~CFS_CAP_FS_MASK;
+ else
+ ucred->mu_cap = pud->pud_cap;
+ ucred->mu_valid = UCRED_NEW;
+@@ -406,7 +406,7 @@ static int old_init_ucred(struct mdt_thr
+
+ /* remove fs privilege for non-root user */
+ if (uc->mu_fsuid)
+- uc->mu_cap = body->capability & ~CAP_FS_MASK;
++ uc->mu_cap = body->capability & ~CFS_CAP_FS_MASK;
+ else
+ uc->mu_cap = body->capability;
+ uc->mu_valid = UCRED_OLD;
+@@ -446,7 +446,7 @@ static int old_init_ucred_reint(struct m
+
+ /* remove fs privilege for non-root user */
+ if (uc->mu_fsuid)
+- uc->mu_cap &= ~CAP_FS_MASK;
++ uc->mu_cap &= ~CFS_CAP_FS_MASK;
+ uc->mu_valid = UCRED_OLD;
+
+ RETURN(0);
+Index: lustre/obdclass/llog_obd.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/obdclass/llog_obd.c,v
+retrieving revision 1.24
+diff -u -p -r1.24 llog_obd.c
+--- lustre/obdclass/llog_obd.c 27 Jul 2008 21:25:35 -0000 1.24
++++ lustre/obdclass/llog_obd.c 1 Sep 2008 15:26:56 -0000
+@@ -210,8 +210,7 @@ int llog_add(struct llog_ctxt *ctxt, str
+ struct lov_stripe_md *lsm, struct llog_cookie *logcookies,
+ int numcookies)
+ {
+- __u32 cap;
+- int rc;
++ int raised, rc;
+ ENTRY;
+
+ if (!ctxt) {
+@@ -220,10 +219,12 @@ int llog_add(struct llog_ctxt *ctxt, str
+ }
+
+ CTXT_CHECK_OP(ctxt, add, -EOPNOTSUPP);
+- cap = current->cap_effective;
+- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
++ raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
++ if (!raised)
++ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+ rc = CTXTP(ctxt, add)(ctxt, rec, lsm, logcookies, numcookies);
+- current->cap_effective = cap;
++ if (!raised)
++ cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+ RETURN(rc);
+ }
+ EXPORT_SYMBOL(llog_add);
+Index: lustre/obdclass/obdo.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/obdclass/obdo.c,v
+retrieving revision 1.12
+diff -u -p -r1.12 obdo.c
+--- lustre/obdclass/obdo.c 27 Jul 2008 21:25:39 -0000 1.12
++++ lustre/obdclass/obdo.c 1 Sep 2008 15:26:57 -0000
+@@ -164,7 +164,7 @@ void obdo_from_iattr(struct obdo *oa, st
+ if (ia_valid & ATTR_MODE) {
+ oa->o_mode = attr->ia_mode;
+ oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
+- if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
++ if (!in_group_p(oa->o_gid) && !cfs_capable(CFS_CAP_FSETID))
+ oa->o_mode &= ~S_ISGID;
+ }
+ if (ia_valid & ATTR_UID) {
+@@ -212,7 +212,7 @@ void iattr_from_obdo(struct iattr *attr,
+ if (valid & OBD_MD_FLMODE) {
+ attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
+ attr->ia_valid |= ATTR_MODE;
+- if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
++ if (!in_group_p(oa->o_gid) && !cfs_capable(CFS_CAP_FSETID))
+ attr->ia_mode &= ~S_ISGID;
+ }
+ if (valid & OBD_MD_FLUID) {
+Index: lustre/obdecho/echo_client.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/obdecho/echo_client.c,v
+retrieving revision 1.49
+diff -u -p -r1.49 echo_client.c
+--- lustre/obdecho/echo_client.c 27 Jul 2008 21:25:45 -0000 1.49
++++ lustre/obdecho/echo_client.c 1 Sep 2008 15:26:57 -0000
+@@ -1148,7 +1148,7 @@ echo_client_iocontrol(unsigned int cmd,
+
+ switch (cmd) {
+ case OBD_IOC_CREATE: /* may create echo object */
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ rc = echo_create_object (obd, 1, &data->ioc_obdo1,
+@@ -1157,7 +1157,7 @@ echo_client_iocontrol(unsigned int cmd,
+ GOTO(out, rc);
+
+ case OBD_IOC_DESTROY:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ rc = echo_get_object (&eco, obd, &data->ioc_obdo1);
+@@ -1185,7 +1185,7 @@ echo_client_iocontrol(unsigned int cmd,
+ GOTO(out, rc);
+
+ case OBD_IOC_SETATTR:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ rc = echo_get_object (&eco, obd, &data->ioc_obdo1);
+@@ -1200,7 +1200,7 @@ echo_client_iocontrol(unsigned int cmd,
+ GOTO(out, rc);
+
+ case OBD_IOC_BRW_WRITE:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ rw = OBD_BRW_WRITE;
+@@ -1219,7 +1219,7 @@ echo_client_iocontrol(unsigned int cmd,
+ GOTO(out, rc);
+
+ case ECHO_IOC_SET_STRIPE:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ if (data->ioc_pbuf1 == NULL) { /* unset */
+@@ -1236,7 +1236,7 @@ echo_client_iocontrol(unsigned int cmd,
+ GOTO (out, rc);
+
+ case ECHO_IOC_ENQUEUE:
+- if (!capable (CAP_SYS_ADMIN))
++ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO (out, rc = -EPERM);
+
+ rc = echo_client_enqueue(exp, &data->ioc_obdo1,
+Index: lustre/obdfilter/filter.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/obdfilter/filter.c,v
+retrieving revision 1.295
+diff -u -p -r1.295 filter.c
+--- lustre/obdfilter/filter.c 27 Jul 2008 21:25:46 -0000 1.295
++++ lustre/obdfilter/filter.c 1 Sep 2008 15:26:57 -0000
+@@ -1562,8 +1562,9 @@ int filter_vfs_unlink(struct inode *dir,
+ GOTO(out, rc = -EPERM);
+
+ /* check_sticky() */
+- if ((dentry->d_inode->i_uid != current->fsuid && !capable(CAP_FOWNER))||
+- IS_APPEND(dentry->d_inode) || IS_IMMUTABLE(dentry->d_inode))
++ if ((dentry->d_inode->i_uid != current->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
+Index: lustre/obdfilter/filter_io_26.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/obdfilter/filter_io_26.c,v
+retrieving revision 1.49
+diff -u -p -r1.49 filter_io_26.c
+--- lustre/obdfilter/filter_io_26.c 27 Jul 2008 21:25:48 -0000 1.49
++++ lustre/obdfilter/filter_io_26.c 1 Sep 2008 15:26:57 -0000
+@@ -754,7 +754,7 @@ int filter_commitrw_write(struct obd_exp
+ CDEBUG(D_INODE, "update UID/GID to %lu/%lu\n",
+ (unsigned long)oa->o_uid, (unsigned long)oa->o_gid);
+
+- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
++ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+
+ iattr.ia_valid |= ATTR_MODE;
+ iattr.ia_mode = inode->i_mode;
+Index: lustre/ptlrpc/sec.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/ptlrpc/sec.c,v
+retrieving revision 1.14
+diff -u -p -r1.14 sec.c
+--- lustre/ptlrpc/sec.c 27 Jul 2008 21:26:07 -0000 1.14
++++ lustre/ptlrpc/sec.c 1 Sep 2008 15:26:58 -0000
+@@ -2203,7 +2203,7 @@ int sptlrpc_pack_user_desc(struct lustre
+ pud->pud_gid = cfs_current()->gid;
+ pud->pud_fsuid = cfs_current()->fsuid;
+ pud->pud_fsgid = cfs_current()->fsgid;
+- pud->pud_cap = cfs_current()->cap_effective;
++ pud->pud_cap = cfs_curproc_cap_pack();
+ pud->pud_ngroups = (msg->lm_buflens[offset] - sizeof(*pud)) / 4;
+
+ #ifdef __KERNEL__
+Index: lustre/quota/quota_interface.c
+===================================================================
+RCS file: /cvsroot/cfs/lustre-core/quota/quota_interface.c,v
+retrieving revision 1.8
+diff -u -p -r1.8 quota_interface.c
+--- lustre/quota/quota_interface.c 27 Jul 2008 21:26:19 -0000 1.8
++++ lustre/quota/quota_interface.c 1 Sep 2008 15:26:58 -0000
+@@ -353,9 +353,9 @@ static int filter_quota_enforce(struct o
+ RETURN(0);
+
+ if (ignore)
+- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
++ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+ else
+- cap_lower(current->cap_effective, CAP_SYS_RESOURCE);
++ cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+
+ RETURN(0);
+ }
More information about the Pkg-lustre-svn-commit
mailing list