linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning
@ 2014-01-22 13:47 Peng Tao
  2014-01-22 13:47 ` [PATCH 2/6] staging/lustre/libcfs: remove cfs_curproc_groups_nr Peng Tao
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Laura Abbott, Andreas Dilger

I got this building Lustre:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function ‘kiblnd_kvaddr_to_page’:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:532:2: warning: passing argument 1 of ‘is_vmalloc_addr’ makes pointer from integer without a cast [enabled by default]

Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 9364863..6f58ead 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -529,7 +529,7 @@ kiblnd_kvaddr_to_page (unsigned long vaddr)
 {
 	struct page *page;
 
-	if (is_vmalloc_addr(vaddr)) {
+	if (is_vmalloc_addr((void *)vaddr)) {
 		page = vmalloc_to_page ((void *)vaddr);
 		LASSERT (page != NULL);
 		return page;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/6] staging/lustre/libcfs: remove cfs_curproc_groups_nr
  2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  2014-01-22 13:47 ` [PATCH 3/6] staging/lustre/libcfs: remove cfs_curproc_cap_unpack Peng Tao
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

no user.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../staging/lustre/include/linux/libcfs/curproc.h  |    7 -------
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   11 -----------
 2 files changed, 18 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h
index 507d16b..9e52393 100644
--- a/drivers/staging/lustre/include/linux/libcfs/curproc.h
+++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h
@@ -44,13 +44,6 @@
 #define __LIBCFS_CURPROC_H__
 
 /*
- * Portable API to access common characteristics of "current" UNIX process.
- *
- * Implemented in portals/include/libcfs/<os>/
- */
-int    cfs_curproc_groups_nr(void);
-
-/*
  * Plus, platform-specific constant
  *
  * CFS_CURPROC_COMM_MAX,
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index a2ef64c..0137062 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -55,16 +55,6 @@
  * for Linux kernel.
  */
 
-int    cfs_curproc_groups_nr(void)
-{
-	int nr;
-
-	task_lock(current);
-	nr = current_cred()->group_info->ngroups;
-	task_unlock(current);
-	return nr;
-}
-
 /* Currently all the CFS_CAP_* defines match CAP_* ones. */
 #define cfs_cap_pack(cap) (cap)
 #define cfs_cap_unpack(cap) (cap)
@@ -292,7 +282,6 @@ out:
 }
 EXPORT_SYMBOL(cfs_get_environ);
 
-EXPORT_SYMBOL(cfs_curproc_groups_nr);
 EXPORT_SYMBOL(cfs_cap_raise);
 EXPORT_SYMBOL(cfs_cap_lower);
 EXPORT_SYMBOL(cfs_cap_raised);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] staging/lustre/libcfs: remove cfs_curproc_cap_unpack
  2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
  2014-01-22 13:47 ` [PATCH 2/6] staging/lustre/libcfs: remove cfs_curproc_groups_nr Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  2014-01-22 13:47 ` [PATCH 4/6] staging/lustre/libcfs: remove cfs_cap_{un}pack Peng Tao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

no user.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../staging/lustre/include/linux/libcfs/curproc.h  |    1 -
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   10 ----------
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h
index 9e52393..d12cfb1 100644
--- a/drivers/staging/lustre/include/linux/libcfs/curproc.h
+++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h
@@ -84,7 +84,6 @@ 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__ */
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index 0137062..65cb2fa 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -116,15 +116,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
 	return cap;
 }
 
-void cfs_curproc_cap_unpack(cfs_cap_t cap)
-{
-	struct cred *cred;
-	if ((cred = prepare_creds())) {
-		cfs_kernel_cap_unpack(&cred->cap_effective, cap);
-		commit_creds(cred);
-	}
-}
-
 int cfs_capable(cfs_cap_t cap)
 {
 	return capable(cfs_cap_unpack(cap));
@@ -286,7 +277,6 @@ 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);
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] staging/lustre/libcfs: remove cfs_cap_{un}pack
  2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
  2014-01-22 13:47 ` [PATCH 2/6] staging/lustre/libcfs: remove cfs_curproc_groups_nr Peng Tao
  2014-01-22 13:47 ` [PATCH 3/6] staging/lustre/libcfs: remove cfs_curproc_cap_unpack Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  2014-01-22 13:47 ` [PATCH 5/6] staging/lustre/libcfs: remove CAPABILITY_VERSION tests Peng Tao
  2014-01-22 13:47 ` [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable Peng Tao
  4 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   24 ++++++++------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index 65cb2fa..81a1d0d 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -55,15 +55,11 @@
  * for Linux kernel.
  */
 
-/* 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)
 {
 	struct cred *cred;
 	if ((cred = prepare_creds())) {
-		cap_raise(cred->cap_effective, cfs_cap_unpack(cap));
+		cap_raise(cred->cap_effective, cap);
 		commit_creds(cred);
 	}
 }
@@ -72,25 +68,25 @@ void cfs_cap_lower(cfs_cap_t cap)
 {
 	struct cred *cred;
 	if ((cred = prepare_creds())) {
-		cap_lower(cred->cap_effective, cfs_cap_unpack(cap));
+		cap_lower(cred->cap_effective, cap);
 		commit_creds(cred);
 	}
 }
 
 int cfs_cap_raised(cfs_cap_t cap)
 {
-	return cap_raised(current_cap(), cfs_cap_unpack(cap));
+	return cap_raised(current_cap(), cap);
 }
 
 void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
 {
 #if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
-	*cap = cfs_cap_pack(kcap);
+	*cap = kcap;
 #elif defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x20071026
-	*cap = cfs_cap_pack(kcap[0]);
+	*cap = kcap[0];
 #elif defined(_KERNEL_CAPABILITY_VERSION) && _KERNEL_CAPABILITY_VERSION == 0x20080522
 	/* XXX lost high byte */
-	*cap = cfs_cap_pack(kcap.cap[0]);
+	*cap = kcap.cap[0];
 #else
 	#error "need correct _KERNEL_CAPABILITY_VERSION "
 #endif
@@ -99,11 +95,11 @@ void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
 void cfs_kernel_cap_unpack(kernel_cap_t *kcap, cfs_cap_t cap)
 {
 #if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
-	*kcap = cfs_cap_unpack(cap);
+	*kcap = cap;
 #elif defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x20071026
-	(*kcap)[0] = cfs_cap_unpack(cap);
+	(*kcap)[0] = cap;
 #elif defined(_KERNEL_CAPABILITY_VERSION) && _KERNEL_CAPABILITY_VERSION == 0x20080522
-	kcap->cap[0] = cfs_cap_unpack(cap);
+	kcap->cap[0] = cap;
 #else
 	#error "need correct _KERNEL_CAPABILITY_VERSION "
 #endif
@@ -118,7 +114,7 @@ cfs_cap_t cfs_curproc_cap_pack(void)
 
 int cfs_capable(cfs_cap_t cap)
 {
-	return capable(cfs_cap_unpack(cap));
+	return capable(cap);
 }
 
 static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] staging/lustre/libcfs: remove CAPABILITY_VERSION tests
  2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
                   ` (2 preceding siblings ...)
  2014-01-22 13:47 ` [PATCH 4/6] staging/lustre/libcfs: remove cfs_cap_{un}pack Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  2014-01-22 13:47 ` [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable Peng Tao
  4 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

_LINUX_CAPABILITY_VERSION is only for backward compatibility in
user space. Kernel code doesn't care about it.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index 81a1d0d..8b3af7f 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -80,29 +80,13 @@ int cfs_cap_raised(cfs_cap_t cap)
 
 void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
 {
-#if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
-	*cap = kcap;
-#elif defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x20071026
-	*cap = kcap[0];
-#elif defined(_KERNEL_CAPABILITY_VERSION) && _KERNEL_CAPABILITY_VERSION == 0x20080522
 	/* XXX lost high byte */
 	*cap = kcap.cap[0];
-#else
-	#error "need correct _KERNEL_CAPABILITY_VERSION "
-#endif
 }
 
 void cfs_kernel_cap_unpack(kernel_cap_t *kcap, cfs_cap_t cap)
 {
-#if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
-	*kcap = cap;
-#elif defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x20071026
-	(*kcap)[0] = cap;
-#elif defined(_KERNEL_CAPABILITY_VERSION) && _KERNEL_CAPABILITY_VERSION == 0x20080522
 	kcap->cap[0] = cap;
-#else
-	#error "need correct _KERNEL_CAPABILITY_VERSION "
-#endif
 }
 
 cfs_cap_t cfs_curproc_cap_pack(void)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable
  2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
                   ` (3 preceding siblings ...)
  2014-01-22 13:47 ` [PATCH 5/6] staging/lustre/libcfs: remove CAPABILITY_VERSION tests Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  2014-01-24 18:50   ` Dilger, Andreas
  4 siblings, 1 reply; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../staging/lustre/include/linux/libcfs/curproc.h  |    1 -
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |    6 ------
 .../lustre/lustre/libcfs/linux/linux-module.c      |    4 ++--
 drivers/staging/lustre/lustre/llite/dir.c          |    8 ++++----
 drivers/staging/lustre/lustre/llite/file.c         |   10 +++++-----
 drivers/staging/lustre/lustre/llite/llite_lib.c    |    2 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |    2 +-
 .../lustre/lustre/obdclass/linux/linux-module.c    |    2 +-
 drivers/staging/lustre/lustre/obdclass/obdo.c      |    4 ++--
 .../staging/lustre/lustre/obdecho/echo_client.c    |   16 ++++++++--------
 drivers/staging/lustre/lustre/osc/osc_cache.c      |    4 ++--
 drivers/staging/lustre/lustre/osc/osc_io.c         |    2 +-
 drivers/staging/lustre/lustre/osc/osc_page.c       |    2 +-
 13 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h
index d12cfb1..8fd47c9 100644
--- a/drivers/staging/lustre/include/linux/libcfs/curproc.h
+++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h
@@ -84,7 +84,6 @@ 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);
-int cfs_capable(cfs_cap_t cap);
 
 /* __LIBCFS_CURPROC_H__ */
 #endif
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index 8b3af7f..6d0bd22 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -96,11 +96,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
 	return cap;
 }
 
-int cfs_capable(cfs_cap_t cap)
-{
-	return capable(cap);
-}
-
 static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
 				 void *buf, int len, int write)
 {
@@ -257,7 +252,6 @@ EXPORT_SYMBOL(cfs_cap_raise);
 EXPORT_SYMBOL(cfs_cap_lower);
 EXPORT_SYMBOL(cfs_cap_raised);
 EXPORT_SYMBOL(cfs_curproc_cap_pack);
-EXPORT_SYMBOL(cfs_capable);
 
 /*
  * Local variables:
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 55296a3..e6eae06 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -150,12 +150,12 @@ static long libcfs_ioctl(struct file *file,
 	/* Handle platform-dependent IOC requests */
 	switch (cmd) {
 	case IOC_LIBCFS_PANIC:
-		if (!cfs_capable(CFS_CAP_SYS_BOOT))
+		if (!capable(CFS_CAP_SYS_BOOT))
 			return (-EPERM);
 		panic("debugctl-invoked panic");
 		return (0);
 	case IOC_LIBCFS_MEMHOG:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			return -EPERM;
 		/* go thought */
 	}
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 1b217c8..a6860e8 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1085,7 +1085,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
 	case Q_QUOTAOFF:
 	case Q_SETQUOTA:
 	case Q_SETINFO:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+		if (!capable(CFS_CAP_SYS_ADMIN) ||
 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
 			return -EPERM;
 		break;
@@ -1094,7 +1094,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
 		      uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
 		     (type == GRPQUOTA &&
 		      !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
-		    (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+		    (!capable(CFS_CAP_SYS_ADMIN) ||
 		     sbi->ll_flags & LL_SBI_RMT_CLIENT))
 			return -EPERM;
 		break;
@@ -1602,7 +1602,7 @@ out_rmdir:
 		struct obd_quotactl *oqctl;
 		int error = 0;
 
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+		if (!capable(CFS_CAP_SYS_ADMIN) ||
 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
 			return -EPERM;
 
@@ -1626,7 +1626,7 @@ out_rmdir:
 	case OBD_IOC_POLL_QUOTACHECK: {
 		struct if_quotacheck *check;
 
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+		if (!capable(CFS_CAP_SYS_ADMIN) ||
 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
 			return -EPERM;
 
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index c12821a..19125d5 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1340,7 +1340,7 @@ static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
 	struct ll_recreate_obj ucreat;
 	struct ost_id		oi;
 
-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+	if (!capable(CFS_CAP_SYS_ADMIN))
 		return -EPERM;
 
 	if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
@@ -1358,7 +1358,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
 	struct ost_id	oi;
 	obd_count	ost_idx;
 
-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+	if (!capable(CFS_CAP_SYS_ADMIN))
 		return -EPERM;
 
 	if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
@@ -1497,7 +1497,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
 					    sizeof(struct lov_user_ost_data);
 	int			 rc;
 
-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+	if (!capable(CFS_CAP_SYS_ADMIN))
 		return -EPERM;
 
 	OBD_ALLOC_LARGE(lump, lum_size);
@@ -1747,7 +1747,7 @@ int ll_fid2path(struct inode *inode, void *arg)
 	struct getinfo_fid2path	*gfout, *gfin;
 	int			 outsize, rc;
 
-	if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
+	if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
 	    !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
 		return -EPERM;
 
@@ -2093,7 +2093,7 @@ static int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss)
 	/* Non-root users are forbidden to set or clear flags which are
 	 * NOT defined in HSM_USER_MASK. */
 	if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
-	    !cfs_capable(CFS_CAP_SYS_ADMIN))
+	    !capable(CFS_CAP_SYS_ADMIN))
 		return -EPERM;
 
 	op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index b0b6941..85c01e1 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1403,7 +1403,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 	/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
 	if (attr->ia_valid & TIMES_SET_FLAGS) {
 		if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
-		    !cfs_capable(CFS_CAP_FOWNER))
+		    !capable(CFS_CAP_FOWNER))
 			return -EPERM;
 	}
 
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 3a7d03c..af83580 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -95,7 +95,7 @@ int xattr_type_filter(struct ll_sb_info *sbi, int xattr_type)
 
 	if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
 		return -EOPNOTSUPP;
-	if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
+	if (xattr_type == XATTR_TRUSTED_T && !capable(CFS_CAP_SYS_ADMIN))
 		return -EPERM;
 	if (xattr_type == XATTR_OTHER_T)
 		return -EOPNOTSUPP;
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 121a856..ba20776 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -184,7 +184,7 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd,
 	int err = 0;
 
 	/* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
-	if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
+	if (!capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
 		return err = -EACCES;
 	if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
 		return err = -ENOTTY;
diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
index 7099764..e9cd6db 100644
--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
@@ -233,7 +233,7 @@ void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
 		oa->o_mode = attr->ia_mode;
 		oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
 		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
-		    !cfs_capable(CFS_CAP_FSETID))
+		    !capable(CFS_CAP_FSETID))
 			oa->o_mode &= ~S_ISGID;
 	}
 	if (ia_valid & ATTR_UID) {
@@ -282,7 +282,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid)
 		attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
 		attr->ia_valid |= ATTR_MODE;
 		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
-		    !cfs_capable(CFS_CAP_FSETID))
+		    !capable(CFS_CAP_FSETID))
 			attr->ia_mode &= ~S_ISGID;
 	}
 	if (valid & OBD_MD_FLUID) {
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 9b2dea2..268a202 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -2764,7 +2764,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
 	switch (cmd) {
 	case OBD_IOC_CREATE:		    /* may create echo object */
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1,
@@ -2778,7 +2778,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		int dirlen;
 		__u64 id;
 
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO(out, rc = -EPERM);
 
 		count = data->ioc_count;
@@ -2806,7 +2806,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		__u64	    seq;
 		int	      max_count;
 
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO(out, rc = -EPERM);
 
 		cl_env = cl_env_get(&refcheck);
@@ -2838,7 +2838,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO(out, rc);
 	}
 	case OBD_IOC_DESTROY:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		rc = echo_get_object(&eco, ed, oa);
@@ -2863,7 +2863,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO(out, rc);
 
 	case OBD_IOC_SETATTR:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		rc = echo_get_object(&eco, ed, oa);
@@ -2878,7 +2878,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO(out, rc);
 
 	case OBD_IOC_BRW_WRITE:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		rw = OBD_BRW_WRITE;
@@ -2897,7 +2897,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO(out, rc);
 
 	case ECHO_IOC_SET_STRIPE:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		if (data->ioc_pbuf1 == NULL) {  /* unset */
@@ -2914,7 +2914,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO (out, rc);
 
 	case ECHO_IOC_ENQUEUE:
-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+		if (!capable(CFS_CAP_SYS_ADMIN))
 			GOTO (out, rc = -EPERM);
 
 		rc = echo_client_enqueue(exp, oa,
diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index be4511e..b92a02e 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -2146,7 +2146,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
 	oap->oap_obj_off = offset;
 	LASSERT(!(offset & ~CFS_PAGE_MASK));
 
-	if (!client_is_remote(exp) && cfs_capable(CFS_CAP_SYS_RESOURCE))
+	if (!client_is_remote(exp) && capable(CFS_CAP_SYS_RESOURCE))
 		oap->oap_brw_flags = OBD_BRW_NOQUOTA;
 
 	INIT_LIST_HEAD(&oap->oap_pending_item);
@@ -2186,7 +2186,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
 	/* Set the OBD_BRW_SRVLOCK before the page is queued. */
 	brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
 	if (!client_is_remote(osc_export(osc)) &&
-	    cfs_capable(CFS_CAP_SYS_RESOURCE)) {
+	    capable(CFS_CAP_SYS_RESOURCE)) {
 		brw_flags |= OBD_BRW_NOQUOTA;
 		cmd |= OBD_BRW_NOQUOTA;
 	}
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
index 681d60a..777ae24 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -297,7 +297,7 @@ static int osc_io_commit_write(const struct lu_env *env,
 	 */
 	osc_page_touch(env, cl2osc_page(slice), to);
 	if (!client_is_remote(osc_export(obj)) &&
-	    cfs_capable(CFS_CAP_SYS_RESOURCE))
+	    capable(CFS_CAP_SYS_RESOURCE))
 		oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
 
 	if (oio->oi_lockless)
diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c
index 4909e486..96cb6e2 100644
--- a/drivers/staging/lustre/lustre/osc/osc_page.c
+++ b/drivers/staging/lustre/lustre/osc/osc_page.c
@@ -561,7 +561,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
 	oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags;
 
 	if (!client_is_remote(osc_export(obj)) &&
-			cfs_capable(CFS_CAP_SYS_RESOURCE)) {
+			capable(CFS_CAP_SYS_RESOURCE)) {
 		oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
 		oap->oap_cmd |= OBD_BRW_NOQUOTA;
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable
  2014-01-22 13:47 ` [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable Peng Tao
@ 2014-01-24 18:50   ` Dilger, Andreas
  2014-02-11  9:43     ` Peng Tao
  0 siblings, 1 reply; 10+ messages in thread
From: Dilger, Andreas @ 2014-01-24 18:50 UTC (permalink / raw)
  To: Peng Tao, Greg Kroah-Hartman; +Cc: linux-kernel

On 2014/01/22, 6:47 AM, "Peng Tao" <bergwolf@gmail.com> wrote:
>diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>index 8b3af7f..6d0bd22 100644
>--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>@@ -96,11 +96,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
> 	return cap;
> }
> 
>-int cfs_capable(cfs_cap_t cap)
>-{
>-	return capable(cap);
>-}

If you're replacing cfs_capable() with capable() you should also replace
the use of CFS_CAP_* at the callers with CAP_* for consistency.  The
CFS_CAP_* constants could also be removed at that point.

Cheers, Andreas

> static int cfs_access_process_vm(struct task_struct *tsk, unsigned long
>addr,
> 				 void *buf, int len, int write)
> {
>@@ -257,7 +252,6 @@ EXPORT_SYMBOL(cfs_cap_raise);
> EXPORT_SYMBOL(cfs_cap_lower);
> EXPORT_SYMBOL(cfs_cap_raised);
> EXPORT_SYMBOL(cfs_curproc_cap_pack);
>-EXPORT_SYMBOL(cfs_capable);
> 
> /*
>  * Local variables:
>diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>index 55296a3..e6eae06 100644
>--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>@@ -150,12 +150,12 @@ static long libcfs_ioctl(struct file *file,
> 	/* Handle platform-dependent IOC requests */
> 	switch (cmd) {
> 	case IOC_LIBCFS_PANIC:
>-		if (!cfs_capable(CFS_CAP_SYS_BOOT))
>+		if (!capable(CFS_CAP_SYS_BOOT))
> 			return (-EPERM);
> 		panic("debugctl-invoked panic");
> 		return (0);
> 	case IOC_LIBCFS_MEMHOG:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			return -EPERM;
> 		/* go thought */
> 	}
>diff --git a/drivers/staging/lustre/lustre/llite/dir.c
>b/drivers/staging/lustre/lustre/llite/dir.c
>index 1b217c8..a6860e8 100644
>--- a/drivers/staging/lustre/lustre/llite/dir.c
>+++ b/drivers/staging/lustre/lustre/llite/dir.c
>@@ -1085,7 +1085,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi,
>struct if_quotactl *qctl)
> 	case Q_QUOTAOFF:
> 	case Q_SETQUOTA:
> 	case Q_SETINFO:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>+		if (!capable(CFS_CAP_SYS_ADMIN) ||
> 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
> 			return -EPERM;
> 		break;
>@@ -1094,7 +1094,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi,
>struct if_quotactl *qctl)
> 		      uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
> 		     (type == GRPQUOTA &&
> 		      !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
>-		    (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>+		    (!capable(CFS_CAP_SYS_ADMIN) ||
> 		     sbi->ll_flags & LL_SBI_RMT_CLIENT))
> 			return -EPERM;
> 		break;
>@@ -1602,7 +1602,7 @@ out_rmdir:
> 		struct obd_quotactl *oqctl;
> 		int error = 0;
> 
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>+		if (!capable(CFS_CAP_SYS_ADMIN) ||
> 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
> 			return -EPERM;
> 
>@@ -1626,7 +1626,7 @@ out_rmdir:
> 	case OBD_IOC_POLL_QUOTACHECK: {
> 		struct if_quotacheck *check;
> 
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>+		if (!capable(CFS_CAP_SYS_ADMIN) ||
> 		    sbi->ll_flags & LL_SBI_RMT_CLIENT)
> 			return -EPERM;
> 
>diff --git a/drivers/staging/lustre/lustre/llite/file.c
>b/drivers/staging/lustre/lustre/llite/file.c
>index c12821a..19125d5 100644
>--- a/drivers/staging/lustre/lustre/llite/file.c
>+++ b/drivers/staging/lustre/lustre/llite/file.c
>@@ -1340,7 +1340,7 @@ static int ll_lov_recreate_obj(struct inode *inode,
>unsigned long arg)
> 	struct ll_recreate_obj ucreat;
> 	struct ost_id		oi;
> 
>-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+	if (!capable(CFS_CAP_SYS_ADMIN))
> 		return -EPERM;
> 
> 	if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
>@@ -1358,7 +1358,7 @@ static int ll_lov_recreate_fid(struct inode *inode,
>unsigned long arg)
> 	struct ost_id	oi;
> 	obd_count	ost_idx;
> 
>-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+	if (!capable(CFS_CAP_SYS_ADMIN))
> 		return -EPERM;
> 
> 	if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
>@@ -1497,7 +1497,7 @@ static int ll_lov_setea(struct inode *inode, struct
>file *file,
> 					    sizeof(struct lov_user_ost_data);
> 	int			 rc;
> 
>-	if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+	if (!capable(CFS_CAP_SYS_ADMIN))
> 		return -EPERM;
> 
> 	OBD_ALLOC_LARGE(lump, lum_size);
>@@ -1747,7 +1747,7 @@ int ll_fid2path(struct inode *inode, void *arg)
> 	struct getinfo_fid2path	*gfout, *gfin;
> 	int			 outsize, rc;
> 
>-	if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
>+	if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
> 	    !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
> 		return -EPERM;
> 
>@@ -2093,7 +2093,7 @@ static int ll_hsm_state_set(struct inode *inode,
>struct hsm_state_set *hss)
> 	/* Non-root users are forbidden to set or clear flags which are
> 	 * NOT defined in HSM_USER_MASK. */
> 	if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
>-	    !cfs_capable(CFS_CAP_SYS_ADMIN))
>+	    !capable(CFS_CAP_SYS_ADMIN))
> 		return -EPERM;
> 
> 	op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
>diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c
>b/drivers/staging/lustre/lustre/llite/llite_lib.c
>index b0b6941..85c01e1 100644
>--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
>+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
>@@ -1403,7 +1403,7 @@ int ll_setattr_raw(struct dentry *dentry, struct
>iattr *attr, bool hsm_import)
> 	/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
> 	if (attr->ia_valid & TIMES_SET_FLAGS) {
> 		if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
>-		    !cfs_capable(CFS_CAP_FOWNER))
>+		    !capable(CFS_CAP_FOWNER))
> 			return -EPERM;
> 	}
> 
>diff --git a/drivers/staging/lustre/lustre/llite/xattr.c
>b/drivers/staging/lustre/lustre/llite/xattr.c
>index 3a7d03c..af83580 100644
>--- a/drivers/staging/lustre/lustre/llite/xattr.c
>+++ b/drivers/staging/lustre/lustre/llite/xattr.c
>@@ -95,7 +95,7 @@ int xattr_type_filter(struct ll_sb_info *sbi, int
>xattr_type)
> 
> 	if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
> 		return -EOPNOTSUPP;
>-	if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
>+	if (xattr_type == XATTR_TRUSTED_T && !capable(CFS_CAP_SYS_ADMIN))
> 		return -EPERM;
> 	if (xattr_type == XATTR_OTHER_T)
> 		return -EOPNOTSUPP;
>diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>index 121a856..ba20776 100644
>--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>@@ -184,7 +184,7 @@ static long obd_class_ioctl(struct file *filp,
>unsigned int cmd,
> 	int err = 0;
> 
> 	/* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
>-	if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
>+	if (!capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
> 		return err = -EACCES;
> 	if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
> 		return err = -ENOTTY;
>diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c
>b/drivers/staging/lustre/lustre/obdclass/obdo.c
>index 7099764..e9cd6db 100644
>--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
>+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
>@@ -233,7 +233,7 @@ void obdo_from_iattr(struct obdo *oa, struct iattr
>*attr, unsigned int ia_valid)
> 		oa->o_mode = attr->ia_mode;
> 		oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
> 		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
>-		    !cfs_capable(CFS_CAP_FSETID))
>+		    !capable(CFS_CAP_FSETID))
> 			oa->o_mode &= ~S_ISGID;
> 	}
> 	if (ia_valid & ATTR_UID) {
>@@ -282,7 +282,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo
>*oa, obd_flag valid)
> 		attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
> 		attr->ia_valid |= ATTR_MODE;
> 		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
>-		    !cfs_capable(CFS_CAP_FSETID))
>+		    !capable(CFS_CAP_FSETID))
> 			attr->ia_mode &= ~S_ISGID;
> 	}
> 	if (valid & OBD_MD_FLUID) {
>diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c
>b/drivers/staging/lustre/lustre/obdecho/echo_client.c
>index 9b2dea2..268a202 100644
>--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
>+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
>@@ -2764,7 +2764,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 
> 	switch (cmd) {
> 	case OBD_IOC_CREATE:		    /* may create echo object */
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1,
>@@ -2778,7 +2778,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		int dirlen;
> 		__u64 id;
> 
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO(out, rc = -EPERM);
> 
> 		count = data->ioc_count;
>@@ -2806,7 +2806,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		__u64	    seq;
> 		int	      max_count;
> 
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO(out, rc = -EPERM);
> 
> 		cl_env = cl_env_get(&refcheck);
>@@ -2838,7 +2838,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		GOTO(out, rc);
> 	}
> 	case OBD_IOC_DESTROY:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		rc = echo_get_object(&eco, ed, oa);
>@@ -2863,7 +2863,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		GOTO(out, rc);
> 
> 	case OBD_IOC_SETATTR:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		rc = echo_get_object(&eco, ed, oa);
>@@ -2878,7 +2878,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		GOTO(out, rc);
> 
> 	case OBD_IOC_BRW_WRITE:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		rw = OBD_BRW_WRITE;
>@@ -2897,7 +2897,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		GOTO(out, rc);
> 
> 	case ECHO_IOC_SET_STRIPE:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		if (data->ioc_pbuf1 == NULL) {  /* unset */
>@@ -2914,7 +2914,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>obd_export *exp, int len,
> 		GOTO (out, rc);
> 
> 	case ECHO_IOC_ENQUEUE:
>-		if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>+		if (!capable(CFS_CAP_SYS_ADMIN))
> 			GOTO (out, rc = -EPERM);
> 
> 		rc = echo_client_enqueue(exp, oa,
>diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c
>b/drivers/staging/lustre/lustre/osc/osc_cache.c
>index be4511e..b92a02e 100644
>--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
>+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
>@@ -2146,7 +2146,7 @@ int osc_prep_async_page(struct osc_object *osc,
>struct osc_page *ops,
> 	oap->oap_obj_off = offset;
> 	LASSERT(!(offset & ~CFS_PAGE_MASK));
> 
>-	if (!client_is_remote(exp) && cfs_capable(CFS_CAP_SYS_RESOURCE))
>+	if (!client_is_remote(exp) && capable(CFS_CAP_SYS_RESOURCE))
> 		oap->oap_brw_flags = OBD_BRW_NOQUOTA;
> 
> 	INIT_LIST_HEAD(&oap->oap_pending_item);
>@@ -2186,7 +2186,7 @@ int osc_queue_async_io(const struct lu_env *env,
>struct cl_io *io,
> 	/* Set the OBD_BRW_SRVLOCK before the page is queued. */
> 	brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
> 	if (!client_is_remote(osc_export(osc)) &&
>-	    cfs_capable(CFS_CAP_SYS_RESOURCE)) {
>+	    capable(CFS_CAP_SYS_RESOURCE)) {
> 		brw_flags |= OBD_BRW_NOQUOTA;
> 		cmd |= OBD_BRW_NOQUOTA;
> 	}
>diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c
>b/drivers/staging/lustre/lustre/osc/osc_io.c
>index 681d60a..777ae24 100644
>--- a/drivers/staging/lustre/lustre/osc/osc_io.c
>+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
>@@ -297,7 +297,7 @@ static int osc_io_commit_write(const struct lu_env
>*env,
> 	 */
> 	osc_page_touch(env, cl2osc_page(slice), to);
> 	if (!client_is_remote(osc_export(obj)) &&
>-	    cfs_capable(CFS_CAP_SYS_RESOURCE))
>+	    capable(CFS_CAP_SYS_RESOURCE))
> 		oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
> 
> 	if (oio->oi_lockless)
>diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c
>b/drivers/staging/lustre/lustre/osc/osc_page.c
>index 4909e486..96cb6e2 100644
>--- a/drivers/staging/lustre/lustre/osc/osc_page.c
>+++ b/drivers/staging/lustre/lustre/osc/osc_page.c
>@@ -561,7 +561,7 @@ void osc_page_submit(const struct lu_env *env, struct
>osc_page *opg,
> 	oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags;
> 
> 	if (!client_is_remote(osc_export(obj)) &&
>-			cfs_capable(CFS_CAP_SYS_RESOURCE)) {
>+			capable(CFS_CAP_SYS_RESOURCE)) {
> 		oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
> 		oap->oap_cmd |= OBD_BRW_NOQUOTA;
> 	}
>-- 
>1.7.9.5
>
>


Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable
  2014-01-24 18:50   ` Dilger, Andreas
@ 2014-02-11  9:43     ` Peng Tao
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-02-11  9:43 UTC (permalink / raw)
  To: Dilger, Andreas; +Cc: Greg Kroah-Hartman, linux-kernel

On Sat, Jan 25, 2014 at 2:50 AM, Dilger, Andreas
<andreas.dilger@intel.com> wrote:
> On 2014/01/22, 6:47 AM, "Peng Tao" <bergwolf@gmail.com> wrote:
>>diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>>b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>>index 8b3af7f..6d0bd22 100644
>>--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>>+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
>>@@ -96,11 +96,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
>>       return cap;
>> }
>>
>>-int cfs_capable(cfs_cap_t cap)
>>-{
>>-      return capable(cap);
>>-}
>
> If you're replacing cfs_capable() with capable() you should also replace
> the use of CFS_CAP_* at the callers with CAP_* for consistency.  The
> CFS_CAP_* constants could also be removed at that point.
>
Andreas,

Sorry I missed this one while I was on vacation. Actually I tried to
remove CFS_CAP_* flags in Lustre master and the commit got reverted
later because Shadow pointed out that Lustre cannot wrap all Linux cap
bits into its wire protocol. Only a few bits are defined to use in
order to make the wire protocol extensible.
(https://jira.hpdd.intel.com/browse/LU-1346?focusedCommentId=67801&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-67801).

Thanks,
Tao

> Cheers, Andreas
>
>> static int cfs_access_process_vm(struct task_struct *tsk, unsigned long
>>addr,
>>                                void *buf, int len, int write)
>> {
>>@@ -257,7 +252,6 @@ EXPORT_SYMBOL(cfs_cap_raise);
>> EXPORT_SYMBOL(cfs_cap_lower);
>> EXPORT_SYMBOL(cfs_cap_raised);
>> EXPORT_SYMBOL(cfs_curproc_cap_pack);
>>-EXPORT_SYMBOL(cfs_capable);
>>
>> /*
>>  * Local variables:
>>diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>>b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>>index 55296a3..e6eae06 100644
>>--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>>+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>>@@ -150,12 +150,12 @@ static long libcfs_ioctl(struct file *file,
>>       /* Handle platform-dependent IOC requests */
>>       switch (cmd) {
>>       case IOC_LIBCFS_PANIC:
>>-              if (!cfs_capable(CFS_CAP_SYS_BOOT))
>>+              if (!capable(CFS_CAP_SYS_BOOT))
>>                       return (-EPERM);
>>               panic("debugctl-invoked panic");
>>               return (0);
>>       case IOC_LIBCFS_MEMHOG:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       return -EPERM;
>>               /* go thought */
>>       }
>>diff --git a/drivers/staging/lustre/lustre/llite/dir.c
>>b/drivers/staging/lustre/lustre/llite/dir.c
>>index 1b217c8..a6860e8 100644
>>--- a/drivers/staging/lustre/lustre/llite/dir.c
>>+++ b/drivers/staging/lustre/lustre/llite/dir.c
>>@@ -1085,7 +1085,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi,
>>struct if_quotactl *qctl)
>>       case Q_QUOTAOFF:
>>       case Q_SETQUOTA:
>>       case Q_SETINFO:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>>+              if (!capable(CFS_CAP_SYS_ADMIN) ||
>>                   sbi->ll_flags & LL_SBI_RMT_CLIENT)
>>                       return -EPERM;
>>               break;
>>@@ -1094,7 +1094,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi,
>>struct if_quotactl *qctl)
>>                     uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
>>                    (type == GRPQUOTA &&
>>                     !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
>>-                  (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>>+                  (!capable(CFS_CAP_SYS_ADMIN) ||
>>                    sbi->ll_flags & LL_SBI_RMT_CLIENT))
>>                       return -EPERM;
>>               break;
>>@@ -1602,7 +1602,7 @@ out_rmdir:
>>               struct obd_quotactl *oqctl;
>>               int error = 0;
>>
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>>+              if (!capable(CFS_CAP_SYS_ADMIN) ||
>>                   sbi->ll_flags & LL_SBI_RMT_CLIENT)
>>                       return -EPERM;
>>
>>@@ -1626,7 +1626,7 @@ out_rmdir:
>>       case OBD_IOC_POLL_QUOTACHECK: {
>>               struct if_quotacheck *check;
>>
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
>>+              if (!capable(CFS_CAP_SYS_ADMIN) ||
>>                   sbi->ll_flags & LL_SBI_RMT_CLIENT)
>>                       return -EPERM;
>>
>>diff --git a/drivers/staging/lustre/lustre/llite/file.c
>>b/drivers/staging/lustre/lustre/llite/file.c
>>index c12821a..19125d5 100644
>>--- a/drivers/staging/lustre/lustre/llite/file.c
>>+++ b/drivers/staging/lustre/lustre/llite/file.c
>>@@ -1340,7 +1340,7 @@ static int ll_lov_recreate_obj(struct inode *inode,
>>unsigned long arg)
>>       struct ll_recreate_obj ucreat;
>>       struct ost_id           oi;
>>
>>-      if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+      if (!capable(CFS_CAP_SYS_ADMIN))
>>               return -EPERM;
>>
>>       if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
>>@@ -1358,7 +1358,7 @@ static int ll_lov_recreate_fid(struct inode *inode,
>>unsigned long arg)
>>       struct ost_id   oi;
>>       obd_count       ost_idx;
>>
>>-      if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+      if (!capable(CFS_CAP_SYS_ADMIN))
>>               return -EPERM;
>>
>>       if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
>>@@ -1497,7 +1497,7 @@ static int ll_lov_setea(struct inode *inode, struct
>>file *file,
>>                                           sizeof(struct lov_user_ost_data);
>>       int                      rc;
>>
>>-      if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+      if (!capable(CFS_CAP_SYS_ADMIN))
>>               return -EPERM;
>>
>>       OBD_ALLOC_LARGE(lump, lum_size);
>>@@ -1747,7 +1747,7 @@ int ll_fid2path(struct inode *inode, void *arg)
>>       struct getinfo_fid2path *gfout, *gfin;
>>       int                      outsize, rc;
>>
>>-      if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
>>+      if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
>>           !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
>>               return -EPERM;
>>
>>@@ -2093,7 +2093,7 @@ static int ll_hsm_state_set(struct inode *inode,
>>struct hsm_state_set *hss)
>>       /* Non-root users are forbidden to set or clear flags which are
>>        * NOT defined in HSM_USER_MASK. */
>>       if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
>>-          !cfs_capable(CFS_CAP_SYS_ADMIN))
>>+          !capable(CFS_CAP_SYS_ADMIN))
>>               return -EPERM;
>>
>>       op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
>>diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c
>>b/drivers/staging/lustre/lustre/llite/llite_lib.c
>>index b0b6941..85c01e1 100644
>>--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
>>+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
>>@@ -1403,7 +1403,7 @@ int ll_setattr_raw(struct dentry *dentry, struct
>>iattr *attr, bool hsm_import)
>>       /* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
>>       if (attr->ia_valid & TIMES_SET_FLAGS) {
>>               if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
>>-                  !cfs_capable(CFS_CAP_FOWNER))
>>+                  !capable(CFS_CAP_FOWNER))
>>                       return -EPERM;
>>       }
>>
>>diff --git a/drivers/staging/lustre/lustre/llite/xattr.c
>>b/drivers/staging/lustre/lustre/llite/xattr.c
>>index 3a7d03c..af83580 100644
>>--- a/drivers/staging/lustre/lustre/llite/xattr.c
>>+++ b/drivers/staging/lustre/lustre/llite/xattr.c
>>@@ -95,7 +95,7 @@ int xattr_type_filter(struct ll_sb_info *sbi, int
>>xattr_type)
>>
>>       if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
>>               return -EOPNOTSUPP;
>>-      if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
>>+      if (xattr_type == XATTR_TRUSTED_T && !capable(CFS_CAP_SYS_ADMIN))
>>               return -EPERM;
>>       if (xattr_type == XATTR_OTHER_T)
>>               return -EOPNOTSUPP;
>>diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>>b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>>index 121a856..ba20776 100644
>>--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>>+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>>@@ -184,7 +184,7 @@ static long obd_class_ioctl(struct file *filp,
>>unsigned int cmd,
>>       int err = 0;
>>
>>       /* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
>>-      if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
>>+      if (!capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
>>               return err = -EACCES;
>>       if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
>>               return err = -ENOTTY;
>>diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c
>>b/drivers/staging/lustre/lustre/obdclass/obdo.c
>>index 7099764..e9cd6db 100644
>>--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
>>+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
>>@@ -233,7 +233,7 @@ void obdo_from_iattr(struct obdo *oa, struct iattr
>>*attr, unsigned int ia_valid)
>>               oa->o_mode = attr->ia_mode;
>>               oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
>>               if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
>>-                  !cfs_capable(CFS_CAP_FSETID))
>>+                  !capable(CFS_CAP_FSETID))
>>                       oa->o_mode &= ~S_ISGID;
>>       }
>>       if (ia_valid & ATTR_UID) {
>>@@ -282,7 +282,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo
>>*oa, obd_flag valid)
>>               attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
>>               attr->ia_valid |= ATTR_MODE;
>>               if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
>>-                  !cfs_capable(CFS_CAP_FSETID))
>>+                  !capable(CFS_CAP_FSETID))
>>                       attr->ia_mode &= ~S_ISGID;
>>       }
>>       if (valid & OBD_MD_FLUID) {
>>diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c
>>b/drivers/staging/lustre/lustre/obdecho/echo_client.c
>>index 9b2dea2..268a202 100644
>>--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
>>+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
>>@@ -2764,7 +2764,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>
>>       switch (cmd) {
>>       case OBD_IOC_CREATE:                /* may create echo object */
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1,
>>@@ -2778,7 +2778,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               int dirlen;
>>               __u64 id;
>>
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO(out, rc = -EPERM);
>>
>>               count = data->ioc_count;
>>@@ -2806,7 +2806,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               __u64       seq;
>>               int           max_count;
>>
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO(out, rc = -EPERM);
>>
>>               cl_env = cl_env_get(&refcheck);
>>@@ -2838,7 +2838,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               GOTO(out, rc);
>>       }
>>       case OBD_IOC_DESTROY:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               rc = echo_get_object(&eco, ed, oa);
>>@@ -2863,7 +2863,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               GOTO(out, rc);
>>
>>       case OBD_IOC_SETATTR:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               rc = echo_get_object(&eco, ed, oa);
>>@@ -2878,7 +2878,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               GOTO(out, rc);
>>
>>       case OBD_IOC_BRW_WRITE:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               rw = OBD_BRW_WRITE;
>>@@ -2897,7 +2897,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               GOTO(out, rc);
>>
>>       case ECHO_IOC_SET_STRIPE:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               if (data->ioc_pbuf1 == NULL) {  /* unset */
>>@@ -2914,7 +2914,7 @@ echo_client_iocontrol(unsigned int cmd, struct
>>obd_export *exp, int len,
>>               GOTO (out, rc);
>>
>>       case ECHO_IOC_ENQUEUE:
>>-              if (!cfs_capable(CFS_CAP_SYS_ADMIN))
>>+              if (!capable(CFS_CAP_SYS_ADMIN))
>>                       GOTO (out, rc = -EPERM);
>>
>>               rc = echo_client_enqueue(exp, oa,
>>diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c
>>b/drivers/staging/lustre/lustre/osc/osc_cache.c
>>index be4511e..b92a02e 100644
>>--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
>>+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
>>@@ -2146,7 +2146,7 @@ int osc_prep_async_page(struct osc_object *osc,
>>struct osc_page *ops,
>>       oap->oap_obj_off = offset;
>>       LASSERT(!(offset & ~CFS_PAGE_MASK));
>>
>>-      if (!client_is_remote(exp) && cfs_capable(CFS_CAP_SYS_RESOURCE))
>>+      if (!client_is_remote(exp) && capable(CFS_CAP_SYS_RESOURCE))
>>               oap->oap_brw_flags = OBD_BRW_NOQUOTA;
>>
>>       INIT_LIST_HEAD(&oap->oap_pending_item);
>>@@ -2186,7 +2186,7 @@ int osc_queue_async_io(const struct lu_env *env,
>>struct cl_io *io,
>>       /* Set the OBD_BRW_SRVLOCK before the page is queued. */
>>       brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
>>       if (!client_is_remote(osc_export(osc)) &&
>>-          cfs_capable(CFS_CAP_SYS_RESOURCE)) {
>>+          capable(CFS_CAP_SYS_RESOURCE)) {
>>               brw_flags |= OBD_BRW_NOQUOTA;
>>               cmd |= OBD_BRW_NOQUOTA;
>>       }
>>diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c
>>b/drivers/staging/lustre/lustre/osc/osc_io.c
>>index 681d60a..777ae24 100644
>>--- a/drivers/staging/lustre/lustre/osc/osc_io.c
>>+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
>>@@ -297,7 +297,7 @@ static int osc_io_commit_write(const struct lu_env
>>*env,
>>        */
>>       osc_page_touch(env, cl2osc_page(slice), to);
>>       if (!client_is_remote(osc_export(obj)) &&
>>-          cfs_capable(CFS_CAP_SYS_RESOURCE))
>>+          capable(CFS_CAP_SYS_RESOURCE))
>>               oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
>>
>>       if (oio->oi_lockless)
>>diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c
>>b/drivers/staging/lustre/lustre/osc/osc_page.c
>>index 4909e486..96cb6e2 100644
>>--- a/drivers/staging/lustre/lustre/osc/osc_page.c
>>+++ b/drivers/staging/lustre/lustre/osc/osc_page.c
>>@@ -561,7 +561,7 @@ void osc_page_submit(const struct lu_env *env, struct
>>osc_page *opg,
>>       oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags;
>>
>>       if (!client_is_remote(osc_export(obj)) &&
>>-                      cfs_capable(CFS_CAP_SYS_RESOURCE)) {
>>+                      capable(CFS_CAP_SYS_RESOURCE)) {
>>               oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
>>               oap->oap_cmd |= OBD_BRW_NOQUOTA;
>>       }
>>--
>>1.7.9.5
>>
>>
>
>
> Cheers, Andreas
> --
> Andreas Dilger
>
> Lustre Software Architect
> Intel High Performance Data Division
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning
  2014-01-22 13:40 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
@ 2014-01-22 13:47 ` Peng Tao
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Peng Tao, Laura Abbott, Andreas Dilger

Hi Greg,

I got gmail failure after git send-email sent the first two patches.
Please drop the two and I'll resend the whole series.

Thanks,
Tao

On Wed, Jan 22, 2014 at 9:40 PM, Peng Tao <bergwolf@gmail.com> wrote:
> I got this building Lustre:
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function ‘kiblnd_kvaddr_to_page’:
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:532:2: warning: passing argument 1 of ‘is_vmalloc_addr’ makes pointer from integer without a cast [enabled by default]
>
> Cc: Laura Abbott <lauraa@codeaurora.org>
> Cc: Andreas Dilger <andreas.dilger@intel.com>
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> index 9364863..6f58ead 100644
> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> @@ -529,7 +529,7 @@ kiblnd_kvaddr_to_page (unsigned long vaddr)
>  {
>         struct page *page;
>
> -       if (is_vmalloc_addr(vaddr)) {
> +       if (is_vmalloc_addr((void *)vaddr)) {
>                 page = vmalloc_to_page ((void *)vaddr);
>                 LASSERT (page != NULL);
>                 return page;
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning
@ 2014-01-22 13:40 Peng Tao
  2014-01-22 13:47 ` Peng Tao
  0 siblings, 1 reply; 10+ messages in thread
From: Peng Tao @ 2014-01-22 13:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Laura Abbott, Andreas Dilger

I got this building Lustre:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function ‘kiblnd_kvaddr_to_page’:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:532:2: warning: passing argument 1 of ‘is_vmalloc_addr’ makes pointer from integer without a cast [enabled by default]

Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 9364863..6f58ead 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -529,7 +529,7 @@ kiblnd_kvaddr_to_page (unsigned long vaddr)
 {
 	struct page *page;
 
-	if (is_vmalloc_addr(vaddr)) {
+	if (is_vmalloc_addr((void *)vaddr)) {
 		page = vmalloc_to_page ((void *)vaddr);
 		LASSERT (page != NULL);
 		return page;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-11  9:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-22 13:47 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
2014-01-22 13:47 ` [PATCH 2/6] staging/lustre/libcfs: remove cfs_curproc_groups_nr Peng Tao
2014-01-22 13:47 ` [PATCH 3/6] staging/lustre/libcfs: remove cfs_curproc_cap_unpack Peng Tao
2014-01-22 13:47 ` [PATCH 4/6] staging/lustre/libcfs: remove cfs_cap_{un}pack Peng Tao
2014-01-22 13:47 ` [PATCH 5/6] staging/lustre/libcfs: remove CAPABILITY_VERSION tests Peng Tao
2014-01-22 13:47 ` [PATCH 6/6] staging/lustre/libcfs: remove cfs_capable Peng Tao
2014-01-24 18:50   ` Dilger, Andreas
2014-02-11  9:43     ` Peng Tao
  -- strict thread matches above, loose matches on Subject: below --
2014-01-22 13:40 [PATCH 1/6] staging/lustre/o2iblnd: fix is_vmalloc_addr build warning Peng Tao
2014-01-22 13:47 ` Peng Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).