Skip to contentSkip to conversation

staging/lustre: fix various build issues

PATCH Superseded Peng Tao 2 participants 20 messages Jul 15, 2013 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

v2 cover staging/lustre: fix various build issues

Hi Greg,

Now that 3.11-rc1 is out, please consider queuing following patches to fix various Lustre client build issues. I've verified that we can now pass build on sparc/mips/s390/powerpc/x86, both 32bits and 64bits.

V2 changelog:
Add patches to fix API changes in 3.11 merge window and address comments on v1 patches. Lustre private watchdog is now removed.

Thanks,
Tao

Cc Fengguang Wu <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Andreas Dilger <[email protected]>

Peng Tao (16):
staging/lustre: replace num_physpages with totalram_pages staging/lustre: fix Lustre code link order
staging/lustre: don't assert module owner
staging/lustre: don't assert ln_refcount in LNetGetId stating/lustre: only build if configured as module staging/lustre: remove HIPQUAD
staging/lustre: fix build error when !CONFIG_SMP staging/lustre: fix build on s390
staging/lustre/llite: add missing include file for prefetchw staging/lustre/llite: fix build erorr if CONFIG_FS_POSIX_ACL is off staging/lustre: fix build when CONFIG_UIDGID_STRICT_TYPE_CHECKS is on staging/lustre: fix build error on non-x86 platforms staging/lustre: fix build warnning on 32bit system staging/lustre/llite: fix for d_compare API change staging/lustre/llite: readdir convert to iterate staging/lustre: drop CONFIG_BROKEN

Stephen Rothwell (1):
staging/lustre: fix for invalidatepage() API change

 drivers/staging/lustre/Makefile                    |    2 +-
 .../staging/lustre/include/linux/libcfs/curproc.h  |    2 -
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   25 -
 .../lustre/include/linux/libcfs/libcfs_cpu.h       |   46 +-
 .../lustre/include/linux/libcfs/libcfs_private.h   |    1 -
 .../lustre/include/linux/libcfs/linux/linux-cpu.h  |    6 -
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    4 +-
 .../include/linux/libcfs/linux/linux-tcpip.h       |   15 -
 drivers/staging/lustre/lnet/Makefile               |    2 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |   10 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |   12 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   50 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |   94 ++--
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   60 +--
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   62 +--
 drivers/staging/lustre/lnet/lnet/api-ni.c          |    5 +-
 drivers/staging/lustre/lustre/Kconfig              |    2 +-
 drivers/staging/lustre/lustre/Makefile             |    4 +-
 .../lustre/include/linux/lustre_patchless_compat.h |    2 +-
 .../lustre/lustre/include/linux/lustre_user.h      |   18 +-
 drivers/staging/lustre/lustre/include/linux/lvfs.h |    8 +-
 drivers/staging/lustre/lustre/include/linux/obd.h  |    5 +-
 .../staging/lustre/lustre/include/lprocfs_status.h |    4 +-
 drivers/staging/lustre/lustre/include/lustre_cfg.h |    4 -
 drivers/staging/lustre/lustre/include/lustre_net.h |    7 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      |   10 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     |    2 +-
 drivers/staging/lustre/lustre/libcfs/Makefile      |    2 +-
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |   46 +-
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   16 -
 .../lustre/lustre/libcfs/linux/linux-debug.c       |   45 +-
 .../lustre/lustre/libcfs/linux/linux-module.c      |    2 +-
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |    4 +-
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   |    2 +-
 drivers/staging/lustre/lustre/libcfs/watchdog.c    |  516 --------------------
 drivers/staging/lustre/lustre/llite/dcache.c       |    5 +-
 drivers/staging/lustre/lustre/llite/dir.c          |   55 +--
 .../staging/lustre/lustre/llite/llite_internal.h   |   28 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   13 +-
 drivers/staging/lustre/lustre/llite/llite_nfs.c    |   13 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |   11 +-
 drivers/staging/lustre/lustre/llite/namei.c        |    7 +-
 drivers/staging/lustre/lustre/llite/remote_perm.c  |   11 +-
 drivers/staging/lustre/lustre/llite/rw.c           |    2 +-
 drivers/staging/lustre/lustre/llite/rw26.c         |    5 +-
 drivers/staging/lustre/lustre/llite/vvp_object.c   |    8 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |    2 +
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   12 +-
 drivers/staging/lustre/lustre/lov/lov_io.c         |    2 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |   25 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    8 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    9 +-
 drivers/staging/lustre/lustre/obdclass/idmap.c     |   12 +-
 .../lustre/lustre/obdclass/linux/linux-obdo.c      |    4 +-
 .../lustre/lustre/obdclass/linux/linux-sysctl.c    |    6 +-
 .../lustre/lustre/obdclass/lprocfs_status.c        |    2 +-
 drivers/staging/lustre/lustre/obdclass/lu_object.c |    5 +-
 drivers/staging/lustre/lustre/obdclass/obdo.c      |   16 +-
 .../staging/lustre/lustre/obdecho/echo_client.c    |   12 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c      |    2 +-
 drivers/staging/lustre/lustre/osc/osc_io.c         |    2 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |   19 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |    4 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c     |   19 +-
 65 files changed, 393 insertions(+), 1023 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/watchdog.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v2 1/17 staging/lustre: replace num_physpages with totalram_pages

From: Peng Tao <[email protected]>

The global variable num_physpages is going away. Replace it with totalram_pages.

---
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    4 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      |   10 +++++-----
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   |    2 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |    8 ++++----
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    6 +++---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c    |    6 +++---
 drivers/staging/lustre/lustre/obdclass/lu_object.c |    2 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c      |    2 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |    4 ++--
 10 files changed, 23 insertions(+), 23 deletions(-)
drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h +2 -2
index 042a2bc..63efb7b 100644
@@ -63,9 +63,9 @@
 #if BITS_PER_LONG == 32
 /* limit to lowmem on 32-bit systems */
 #define NUM_CACHEPAGES \
-	min(num_physpages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
+	min(totalram_pages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
 #else
-#define NUM_CACHEPAGES num_physpages
+#define NUM_CACHEPAGES totalram_pages
 #endif
 
 /*
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +5 -5
index 42df530..aace534 100644
@@ -339,8 +339,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
 	cli->cl_avail_grant = 0;
 	/* FIXME: Should limit this for the sum of all cl_dirty_max. */
 	cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024;
-	if (cli->cl_dirty_max >> PAGE_CACHE_SHIFT > num_physpages / 8)
-		cli->cl_dirty_max = num_physpages << (PAGE_CACHE_SHIFT - 3);
+	if (cli->cl_dirty_max >> PAGE_CACHE_SHIFT > totalram_pages / 8)
+		cli->cl_dirty_max = totalram_pages << (PAGE_CACHE_SHIFT - 3);
 	INIT_LIST_HEAD(&cli->cl_cache_waiters);
 	INIT_LIST_HEAD(&cli->cl_loi_ready_list);
 	INIT_LIST_HEAD(&cli->cl_loi_hp_ready_list);
@@ -388,11 +388,11 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
 
 	if (!strcmp(name, LUSTRE_MDC_NAME)) {
 		cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
-	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 128 /* MB */) {
+	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 128 /* MB */) {
 		cli->cl_max_rpcs_in_flight = 2;
-	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 256 /* MB */) {
+	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 256 /* MB */) {
 		cli->cl_max_rpcs_in_flight = 3;
-	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
+	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
 		cli->cl_max_rpcs_in_flight = 4;
 	} else {
 		if (osc_on_mdt(obddev->obd_name))
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +1 -1
index 6f56343..a500a0b 100644
@@ -269,7 +269,7 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
 
 int cfs_trace_max_debug_mb(void)
 {
-	int  total_mb = (num_physpages >> (20 - PAGE_SHIFT));
+	int  total_mb = (totalram_pages >> (20 - PAGE_SHIFT));
 
 	return MAX(512, (total_mb * 80)/100);
 }
drivers/staging/lustre/lustre/llite/lproc_llite.c +4 -4
index 6a82505..a30c411 100644
@@ -243,9 +243,9 @@ static ssize_t ll_max_readahead_mb_seq_write(struct file *file, const char *buff
 	if (rc)
 		return rc;
 
-	if (pages_number < 0 || pages_number > num_physpages / 2) {
+	if (pages_number < 0 || pages_number > totalram_pages / 2) {
 		CERROR("can't set file readahead more than %lu MB\n",
-		       num_physpages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/
+		       totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/
 		return -ERANGE;
 	}
 
@@ -388,10 +388,10 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, const char *buffer,
 	if (rc)
 		RETURN(rc);
 
-	if (pages_number < 0 || pages_number > num_physpages) {
+	if (pages_number < 0 || pages_number > totalram_pages) {
 		CERROR("%s: can't set max cache more than %lu MB\n",
 		       ll_get_fsname(sb, NULL, 0),
-		       num_physpages >> (20 - PAGE_CACHE_SHIFT));
+		       totalram_pages >> (20 - PAGE_CACHE_SHIFT));
 		RETURN(-ERANGE);
 	}
 
drivers/staging/lustre/lustre/obdclass/class_obd.c +3 -3
index af1c2d0..0715cf2 100644
@@ -558,10 +558,10 @@ static int __init init_obdclass(void)
 	/* Default the dirty page cache cap to 1/2 of system memory.
 	 * For clients with less memory, a larger fraction is needed
 	 * for other purposes (mostly for BGL). */
-	if (num_physpages <= 512 << (20 - PAGE_CACHE_SHIFT))
-		obd_max_dirty_pages = num_physpages / 4;
+	if (totalram_pages <= 512 << (20 - PAGE_CACHE_SHIFT))
+		obd_max_dirty_pages = totalram_pages / 4;
 	else
-		obd_max_dirty_pages = num_physpages / 2;
+		obd_max_dirty_pages = totalram_pages / 2;
 
 	err = obd_init_caches();
 	if (err)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +3 -3
index 46aad68..7b94cb7 100644
@@ -202,12 +202,12 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb)
 					       1 << (20 - PAGE_CACHE_SHIFT));
 		/* Don't allow them to let dirty pages exceed 90% of system
 		 * memory and set a hard minimum of 4MB. */
-		if (obd_max_dirty_pages > ((num_physpages / 10) * 9)) {
+		if (obd_max_dirty_pages > ((totalram_pages / 10) * 9)) {
 			CERROR("Refusing to set max dirty pages to %u, which "
 			       "is more than 90%% of available RAM; setting "
 			       "to %lu\n", obd_max_dirty_pages,
-			       ((num_physpages / 10) * 9));
-			obd_max_dirty_pages = ((num_physpages / 10) * 9);
+			       ((totalram_pages / 10) * 9));
+			obd_max_dirty_pages = ((totalram_pages / 10) * 9);
 		} else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) {
 			obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT);
 		}
drivers/staging/lustre/lustre/obdclass/lu_object.c +1 -1
index fdf0ed3..fdaf4f8 100644
@@ -849,7 +849,7 @@ static int lu_htable_order(void)
 	 *
 	 * Size of lu_object is (arbitrary) taken as 1K (together with inode).
 	 */
-	cache_size = num_physpages;
+	cache_size = totalram_pages;
 
 #if BITS_PER_LONG == 32
 	/* limit hashtable size for lowmem systems to low RAM */
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
index 198cf3b..d2f2198 100644
@@ -146,7 +146,7 @@ static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
 
 	if (pages_number <= 0 ||
 	    pages_number > OSC_MAX_DIRTY_MB_MAX << (20 - PAGE_CACHE_SHIFT) ||
-	    pages_number > num_physpages / 4) /* 1/4 of RAM */
+	    pages_number > totalram_pages / 4) /* 1/4 of RAM */
 		return -ERANGE;
 
 	client_obd_list_lock(&cli->cl_loi_list_lock);
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +1 -1
index 3e73254..2bd0d98 100644
@@ -302,7 +302,7 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, const char *buffer,
 	 * hose a kernel by allowing the request history to grow too
 	 * far. */
 	bufpages = (svc->srv_buf_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-	if (val > num_physpages/(2 * bufpages))
+	if (val > totalram_pages / (2 * bufpages))
 		return -ERANGE;
 
 	spin_lock(&svc->srv_lock);
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +2 -2
index bf53f1b..9013745 100644
@@ -156,7 +156,7 @@ int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v)
 		      "max waitqueue depth:     %u\n"
 		      "max wait time:	   "CFS_TIME_T"/%u\n"
 		      ,
-		      num_physpages,
+		      totalram_pages,
 		      PAGES_PER_POOL,
 		      page_pools.epp_max_pages,
 		      page_pools.epp_max_pools,
@@ -705,7 +705,7 @@ int sptlrpc_enc_pool_init(void)
 	 * maximum capacity is 1/8 of total physical memory.
 	 * is the 1/8 a good number?
 	 */
-	page_pools.epp_max_pages = num_physpages / 8;
+	page_pools.epp_max_pages = totalram_pages / 8;
 	page_pools.epp_max_pools = npages_to_npools(page_pools.epp_max_pages);
 
 	init_waitqueue_head(&page_pools.epp_waitq);
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v2 2/17 staging/lustre: fix Lustre code link order

In reply to Peng Tao

Change Makefiles to keep link order in match with Lustre module dependency, so that when Lustre is built in kernel, we'll have the same dependency. Otherwise we'll crash kernel if Lustre is builtin due to missing internal dependency.

---
 drivers/staging/lustre/Makefile        |    2 +-
 drivers/staging/lustre/lnet/Makefile   |    2 +-
 drivers/staging/lustre/lustre/Makefile |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/Makefile +1 -1
index 2616289..fb0e0fa 100644
@@ -1,4 +1,4 @@
 subdir-ccflags-y := -I$(src)/include/
 
-obj-$(CONFIG_LUSTRE_FS)		+= lustre/
 obj-$(CONFIG_LNET)		+= lnet/
+obj-$(CONFIG_LUSTRE_FS)		+= lustre/
drivers/staging/lustre/lnet/Makefile +1 -1
index 374212b..f6f03e3 100644
@@ -1 +1 @@
-obj-$(CONFIG_LNET) := klnds/ lnet/ selftest/
+obj-$(CONFIG_LNET) += lnet/ klnds/ selftest/
drivers/staging/lustre/lustre/Makefile +2 -2
index 3fb94fc..d1eb0bd 100644
@@ -1,2 +1,2 @@
-obj-$(CONFIG_LUSTRE_FS) := fid/ lvfs/ obdclass/ ptlrpc/ obdecho/ mgc/ lov/ \
-			   osc/ mdc/ lmv/ llite/ fld/ libcfs/
+obj-$(CONFIG_LUSTRE_FS) += libcfs/ lvfs/ obdclass/ ptlrpc/ fld/ osc/ mgc/ \
+			   fid/ lov/ mdc/ lmv/ llite/ obdecho/
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v2 3/17 staging/lustre: don't assert module owner

In reply to Peng Tao

It can well be NULL if Lustre is builtin.

---
 drivers/staging/lustre/lustre/obdclass/lu_object.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/staging/lustre/lustre/obdclass/lu_object.c +0 -3
index fdaf4f8..5559732 100644
@@ -1315,7 +1315,6 @@ int lu_context_key_register(struct lu_context_key *key)
 	LASSERT(key->lct_init != NULL);
 	LASSERT(key->lct_fini != NULL);
 	LASSERT(key->lct_tags != 0);
-	LASSERT(key->lct_owner != NULL);
 
 	result = -ENFILE;
 	spin_lock(&lu_keys_guard);
@@ -1349,7 +1348,6 @@ static void key_fini(struct lu_context *ctx, int index)
 		lu_ref_del(&key->lct_reference, "ctx", ctx);
 		atomic_dec(&key->lct_used);
 
-		LASSERT(key->lct_owner != NULL);
 		if ((ctx->lc_tags & LCT_NOREF) == 0) {
 #ifdef CONFIG_MODULE_UNLOAD
 			LINVRNT(module_refcount(key->lct_owner) > 0);
@@ -1557,7 +1555,6 @@ static int keys_fill(struct lu_context *ctx)
 			if (unlikely(IS_ERR(value)))
 				return PTR_ERR(value);
 
-			LASSERT(key->lct_owner != NULL);
 			if (!(ctx->lc_tags & LCT_NOREF))
 				try_module_get(key->lct_owner);
 			lu_ref_add_atomic(&key->lct_reference, "ctx", ctx);
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v2 4/17 staging/lustre: don't assert ln_refcount in LNetGetId

In reply to Peng Tao

If LNetNIInit() fails, we'll get zero ln_refcount. So fail LNetGetId() properly instead of asserting.

We can get to it when socklnd fails to scan network interfaces, which is possible if Lustre is builtin.

---
 drivers/staging/lustre/lnet/lnet/api-ni.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +4 -1
index e88bee3..250c618 100644
@@ -1541,7 +1541,10 @@ LNetGetId(unsigned int index, lnet_process_id_t *id)
 	int		rc = -ENOENT;
 
 	LASSERT(the_lnet.ln_init);
-	LASSERT(the_lnet.ln_refcount > 0);
+
+	/* LNetNI initilization failed? */
+	if (the_lnet.ln_refcount == 0)
+		return rc;
 
 	cpt = lnet_net_lock_current();
 
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH v2 5/17 stating/lustre: only build if configured as module

In reply to Peng Tao

From: Peng Tao <[email protected]>

Lustre internal dependency needs to be cleaned up. Currently, libcfs is acting as a basis of all other modules, while other modules in lustre/ directory in turn depend on lnet modules. It creates a dependency loop that need to be fixed. Hopefully we will remove libcfs in the end. So just disable buildin for now.

---
 drivers/staging/lustre/lustre/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/Kconfig +1 -1
index e0eb830..c59ea55 100644
@@ -1,6 +1,6 @@
 config LUSTRE_FS
 	tristate "Lustre file system client support"
-	depends on STAGING && INET && BROKEN
+	depends on STAGING && INET && m && BROKEN
 	select LNET
 	select CRYPTO
 	select CRYPTO_CRC32
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH v2 6/17 staging/lustre: remove HIPQUAD

In reply to Peng Tao

Stephen Rothwell reported below error on powerpc:

In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:203:0,
from drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h:67,
from drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:41:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c: In function 'kiblnd_dev_need_failover':
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h:215:16: error: implicit declaration of function 'NIPQUAD' [-Werror=implicit-function-declaration]

  static struct libcfs_debug_msg_data msgdata;      \
                ^

We should just remove HIPQUAD and replace it with %pI4.

---
 .../include/linux/libcfs/linux/linux-tcpip.h       |   15 ----
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    8 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |   12 +--
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   50 +++++------
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |   94 ++++++++++----------
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   60 ++++++-------
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   62 ++++++-------
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |    4 +-
 8 files changed, 145 insertions(+), 160 deletions(-)
drivers/staging/lustre/include/linux/libcfs/linux/linux-tcpip.h +0 -15
index 687f33f..7a8d006 100644
@@ -48,21 +48,6 @@
 
 #include <net/sock.h>
 
-#ifndef HIPQUAD
-// XXX Should just kill all users
-#if defined(__LITTLE_ENDIAN)
-#define HIPQUAD(addr) \
-	((unsigned char *)&addr)[3], \
-	((unsigned char *)&addr)[2], \
-	((unsigned char *)&addr)[1], \
-	((unsigned char *)&addr)[0]
-#elif defined(__BIG_ENDIAN)
-#define HIPQUAD NIPQUAD
-#else
-#error "Please fix asm/byteorder.h"
-#endif /* __LITTLE_ENDIAN */
-#endif
-
 typedef struct socket   socket_t;
 
 #define SOCK_SNDBUF(so)	 ((so)->sk->sk_sndbuf)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +4 -4
index 29a9794..3ce4fb0 100644
@@ -2574,8 +2574,8 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
 	rc = rdma_resolve_addr(cmid, (struct sockaddr *)&srcaddr,
 			       (struct sockaddr *)&dstaddr, 1);
 	if (rc != 0 || cmid->device == NULL) {
-		CERROR("Failed to bind %s:%u.%u.%u.%u to device(%p): %d\n",
-		       dev->ibd_ifname, HIPQUAD(dev->ibd_ifip),
+		CERROR("Failed to bind %s:%pI4 to device(%p): %d\n",
+		       dev->ibd_ifname, &dev->ibd_ifip,
 		       cmid->device, rc);
 		rdma_destroy_id(cmid);
 		return rc;
@@ -2647,8 +2647,8 @@ kiblnd_dev_failover(kib_dev_t *dev)
 	/* Bind to failover device or port */
 	rc = rdma_bind_addr(cmid, (struct sockaddr *)&addr);
 	if (rc != 0 || cmid->device == NULL) {
-		CERROR("Failed to bind %s:%u.%u.%u.%u to device(%p): %d\n",
-		       dev->ibd_ifname, HIPQUAD(dev->ibd_ifip),
+		CERROR("Failed to bind %s:%pI4 to device(%p): %d\n",
+		       dev->ibd_ifname, &dev->ibd_ifip,
 		       cmid->device, rc);
 		rdma_destroy_id(cmid);
 		goto out;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +6 -6
index cc62321..76985c5 100644
@@ -1319,9 +1319,9 @@ kiblnd_connect_peer (kib_peer_t *peer)
 	}
 
 	LASSERT (cmid->device != NULL);
-	CDEBUG(D_NET, "%s: connection bound to %s:%u.%u.%u.%u:%s\n",
+	CDEBUG(D_NET, "%s: connection bound to %s:%pI4:%s\n",
 	       libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname,
-	       HIPQUAD(dev->ibd_ifip), cmid->device->name);
+	       &dev->ibd_ifip, cmid->device->name);
 
 	return;
 
@@ -2209,8 +2209,8 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob)
 	if (*kiblnd_tunables.kib_require_priv_port &&
 	    ntohs(peer_addr->sin_port) >= PROT_SOCK) {
 		__u32 ip = ntohl(peer_addr->sin_addr.s_addr);
-		CERROR("Peer's port (%u.%u.%u.%u:%hu) is not privileged\n",
-		       HIPQUAD(ip), ntohs(peer_addr->sin_port));
+		CERROR("Peer's port (%pI4:%hu) is not privileged\n",
+		       &ip, ntohs(peer_addr->sin_port));
 		goto failed;
 	}
 
@@ -2254,11 +2254,11 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob)
 	if (ni == NULL ||			 /* no matching net */
 	    ni->ni_nid != reqmsg->ibm_dstnid ||   /* right NET, wrong NID! */
 	    net->ibn_dev != ibdev) {	      /* wrong device */
-		CERROR("Can't accept %s on %s (%s:%d:%u.%u.%u.%u): "
+		CERROR("Can't accept %s on %s (%s:%d:%pI4): "
 		       "bad dst nid %s\n", libcfs_nid2str(nid),
 		       ni == NULL ? "NA" : libcfs_nid2str(ni->ni_nid),
 		       ibdev->ibd_ifname, ibdev->ibd_nnets,
-		       HIPQUAD(ibdev->ibd_ifip),
+		       &ibdev->ibd_ifip,
 		       libcfs_nid2str(reqmsg->ibm_dstnid));
 
 		goto failed;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +25 -25

114 lines not on this page · raw message

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +47 -47

237 lines not on this page · raw message

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +30 -30

139 lines not on this page · raw message

drivers/staging/lustre/lnet/lnet/acceptor.c +31 -31

161 lines not on this page · raw message

drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +2 -2
index 855c7e8..9cd6143 100644
@@ -641,8 +641,8 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
 	*fatal = !(rc == -EADDRNOTAVAIL);
 
 	CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET,
-	       "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n", rc,
-	       HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip), peer_port);
+	       "Error %d connecting %pI4/%d -> %pI4/%d\n", rc,
+	       &local_ip, local_port, &peer_ip, peer_port);
 
 	sock_release(*sockp);
 	return rc;
Signature · 1 line
1.7.9.5
#7 lore raw

Re: [PATCH-v2 06/17] staging/lustre: remove HIPQUAD

On Mon, 2013-07-15 at 21:08 +0800, Peng Tao wrote:
[]

Quoted 1 line

We should just remove HIPQUAD and replace it with %pI4.

HIPQUAD and NIPQUAD were host and network order variants. Perhaps you need %pI4h for the host uses?

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c

Quoted 1 line
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +0 -0

[]

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c kiblnd_dev_need_failover(kib_dev_t *dev) · line 2579

Quoted 9 lines
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +2 -2
@@ -2574,8 +2574,8 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
 	rc = rdma_resolve_addr(cmid, (struct sockaddr *)&srcaddr,
 			       (struct sockaddr *)&dstaddr, 1);
 	if (rc != 0 || cmid->device == NULL) {
-		CERROR("Failed to bind %s:%u.%u.%u.%u to device(%p): %d\n",
-		       dev->ibd_ifname, HIPQUAD(dev->ibd_ifip),
+		CERROR("Failed to bind %s:%pI4 to device(%p): %d\n",
+		       dev->ibd_ifname, &dev->ibd_ifip,
 		       cmid->device, rc);

Like this one?

author
#8 lore raw

Re: [PATCH-v2 06/17] staging/lustre: remove HIPQUAD

Quoted 7 lines · Joe Perches

On Mon, 2013-07-15 at 21:08 +0800, Peng Tao wrote:
[]

Quoted 1 line

We should just remove HIPQUAD and replace it with %pI4.

HIPQUAD and NIPQUAD were host and network order variants. Perhaps you need %pI4h for the host uses?

Thanks for pointing it out. Yes, you are right. Without the additional specifier, network order is used. I will update the patch to fix it.

Thanks,
Tao

Quoted 14 lines

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c

Quoted 1 line
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +0 -0

[]

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c kiblnd_dev_need_failover(kib_dev_t *dev) · line 2579

Quoted 9 lines
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +2 -2
@@ -2574,8 +2574,8 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
      rc = rdma_resolve_addr(cmid, (struct sockaddr *)&srcaddr,
                             (struct sockaddr *)&dstaddr, 1);
      if (rc != 0 || cmid->device == NULL) {
-             CERROR("Failed to bind %s:%u.%u.%u.%u to device(%p): %d\n",
-                    dev->ibd_ifname, HIPQUAD(dev->ibd_ifip),
+             CERROR("Failed to bind %s:%pI4 to device(%p): %d\n",
+                    dev->ibd_ifname, &dev->ibd_ifip,
                     cmid->device, rc);

Like this one?

author
#9 lore raw

PATCH v2 7/17 staging/lustre: fix build error when !CONFIG_SMP

In reply to Peng Tao

Three functions cfs_cpu_ht_nsiblings, cfs_cpt_cpumask and cfs_cpt_table_print are missing if !CONFIG_SMP.

cpumask_t/nodemask_t/__read_mostly/____cacheline_aligned are redefined.

---
 .../lustre/include/linux/libcfs/libcfs_cpu.h       |   46 ++++++++++----------
 .../lustre/include/linux/libcfs/linux/linux-cpu.h  |    6 ---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    2 +
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |   46 ++------------------
 drivers/staging/lustre/lustre/ptlrpc/service.c     |   11 ++++-
 5 files changed, 37 insertions(+), 74 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +23 -23
index 6ae7415..c87efb4 100644
@@ -75,11 +75,19 @@
 #ifndef __LIBCFS_CPU_H__
 #define __LIBCFS_CPU_H__
 
-#ifndef HAVE_LIBCFS_CPT
-
-typedef unsigned long		cpumask_t;
-typedef unsigned long		nodemask_t;
+/* any CPU partition */
+#define CFS_CPT_ANY		(-1)
 
+#ifdef CONFIG_SMP
+/**
+ * return cpumask of CPU partition \a cpt
+ */
+cpumask_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt);
+/**
+ * print string information of cpt-table
+ */
+int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len);
+#else /* !CONFIG_SMP */
 struct cfs_cpt_table {
 	/* # of CPU partitions */
 	int			ctb_nparts;
@@ -91,10 +99,18 @@ struct cfs_cpt_table {
 	__u64			ctb_version;
 };
 
-#endif /* !HAVE_LIBCFS_CPT */
+static inline cpumask_t *
+cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
+{
+       return NULL;
+}
 
-/* any CPU partition */
-#define CFS_CPT_ANY		(-1)
+static inline int
+cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
+{
+       return 0;
+}
+#endif /* CONFIG_SMP */
 
 extern struct cfs_cpt_table	*cfs_cpt_table;
 
@@ -107,10 +123,6 @@ void cfs_cpt_table_free(struct cfs_cpt_table *cptab);
  */
 struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt);
 /**
- * print string information of cpt-table
- */
-int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len);
-/**
  * return total number of CPU partitions in \a cptab
  */
 int
@@ -124,10 +136,6 @@ int cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt);
  */
 int cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt);
 /**
- * return cpumask of CPU partition \a cpt
- */
-cpumask_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt);
-/**
  * return nodemask of CPU partition \a cpt
  */
 nodemask_t *cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt);
@@ -200,14 +208,6 @@ int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt);
 #define cfs_cpt_for_each(i, cptab)	\
 	for (i = 0; i < cfs_cpt_number(cptab); i++)
 
-#ifndef __read_mostly
-# define __read_mostly
-#endif
-
-#ifndef ____cacheline_aligned
-#define ____cacheline_aligned
-#endif
-
 int  cfs_cpu_init(void);
 void cfs_cpu_fini(void);
 
drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h +0 -6
index 224371c..5f793f2 100644
@@ -81,12 +81,6 @@ struct cfs_cpt_table {
 	nodemask_t			*ctb_nodemask;
 };
 
-void cfs_cpu_core_siblings(int cpu, cpumask_t *mask);
-void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask);
-void cfs_node_to_cpumask(int node, cpumask_t *mask);
-int cfs_cpu_core_nsiblings(int cpu);
-int cfs_cpu_ht_nsiblings(int cpu);
-
 /**
  * comment out definitions for compatible layer
  * #define CFS_CPU_NR			  NR_CPUS
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +2 -0
index 3ce4fb0..511fb16 100644
@@ -702,6 +702,8 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt)
 		return 0;
 
 	mask = cfs_cpt_cpumask(lnet_cpt_table(), cpt);
+	if (mask == NULL)
+		return 0;
 
 	/* hash NID to CPU id in this partition... */
 	off = do_div(nid, cpus_weight(*mask));
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +3 -43

65 lines not on this page · raw message

drivers/staging/lustre/lustre/ptlrpc/service.c +9 -2
index 1667b8e..cd1bab5 100644
@@ -551,6 +551,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
 	if (tc->tc_thr_factor != 0) {
 		int	  factor = tc->tc_thr_factor;
 		const int fade = 4;
+		cpumask_t mask;
 
 		/*
 		 * User wants to increase number of threads with for
@@ -564,7 +565,8 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
 		 * have too many threads no matter how many cores/HTs
 		 * there are.
 		 */
-		if (cfs_cpu_ht_nsiblings(0) > 1) { /* weight is # of HTs */
+		cpumask_copy(&mask, topology_thread_cpumask(0));
+		if (cpus_weight(mask) > 1) { /* weight is # of HTs */
 			/* depress thread factor for hyper-thread */
 			factor = factor - (factor >> 1) + (factor >> 3);
 		}
@@ -2776,11 +2778,13 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
 
 int ptlrpc_hr_init(void)
 {
+	cpumask_t			mask;
 	struct ptlrpc_hr_partition	*hrp;
 	struct ptlrpc_hr_thread		*hrt;
 	int				rc;
 	int				i;
 	int				j;
+	int				weight;
 	ENTRY;
 
 	memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr));
@@ -2793,6 +2797,9 @@ int ptlrpc_hr_init(void)
 
 	init_waitqueue_head(&ptlrpc_hr.hr_waitq);
 
+	cpumask_copy(&mask, topology_thread_cpumask(0));
+	weight = cpus_weight(mask);
+
 	cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
 		hrp->hrp_cpt = i;
 
@@ -2800,7 +2807,7 @@ int ptlrpc_hr_init(void)
 		atomic_set(&hrp->hrp_nstopped, 0);
 
 		hrp->hrp_nthrs = cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i);
-		hrp->hrp_nthrs /= cfs_cpu_ht_nsiblings(0);
+		hrp->hrp_nthrs /= weight;
 
 		LASSERT(hrp->hrp_nthrs > 0);
 		OBD_CPT_ALLOC(hrp->hrp_thrs, ptlrpc_hr.hr_cpt_table, i,
Signature · 1 line
1.7.9.5
author
#10 lore raw

PATCH v2 8/17 staging/lustre: fix build on s390

In reply to Peng Tao

As reported by Fengguang:
In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_idl.h:99:0,
from drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:46,
from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:42,
from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:40,
from drivers/staging/lustre/lustre/obdclass/lu_object.c:53:
drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_user.h:356:10: error: field 'lmd_st' has incomplete type drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_user.h:361:10: error: field 'lmd_st' has incomplete type

---
 .../lustre/lustre/include/linux/lustre_user.h      |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/include/linux/lustre_user.h +11 -7
index ebaf929..ea9393c 100644
@@ -53,15 +53,19 @@
 
 #include <linux/string.h>
 
-#if defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || \
-    defined(__craynv) || defined (__mips64__) || defined(__powerpc64__)
-typedef struct stat     lstat_t;
-#define lstat_f	 lstat
-#define HAVE_LOV_USER_MDS_DATA
-#else
+/*
+ * We need to always use 64bit version because the structure
+ * is shared across entire cluster where 32bit and 64bit machines
+ * are co-existing.
+ */
+#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
 typedef struct stat64   lstat_t;
 #define lstat_f	 lstat64
-#define HAVE_LOV_USER_MDS_DATA
+#else
+typedef struct stat     lstat_t;
+#define lstat_f	 lstat
 #endif
 
+#define HAVE_LOV_USER_MDS_DATA
+
 #endif /* _LUSTRE_USER_H */
Signature · 1 line
1.7.9.5
author
#11 lore raw

PATCH v2 9/17 staging/lustre/llite: add missing include file for prefetchw

In reply to Peng Tao

Got below errors on s390 build:
CC [M] drivers/staging/lustre/lustre/llite/dir.o
drivers/staging/lustre/lustre/llite/dir.c: In function 'll_dir_filler':
drivers/staging/lustre/lustre/llite/dir.c:225:3: error: implicit declaration of function 'prefetchw' [-Werror=implicit-function-declaration]

---
 drivers/staging/lustre/lustre/llite/dir.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/llite/dir.c +1 -0
index 23c61fe..13a6426 100644
@@ -45,6 +45,7 @@
 #include <asm/uaccess.h>
 #include <linux/buffer_head.h>   // for wait_on_buffer
 #include <linux/pagevec.h>
+#include <linux/prefetch.h>
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
Signature · 1 line
1.7.9.5
author
#12 lore raw

PATCH v2 10/17 staging/lustre/llite: fix build erorr if CONFIG_FS_POSIX_ACL is off

In reply to Peng Tao
---
 .../staging/lustre/lustre/llite/llite_internal.h   |   21 ++++++++++++--------
 drivers/staging/lustre/lustre/llite/xattr.c        |    2 ++
 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +13 -8
index 5227c5c..1069b8d 100644
@@ -438,14 +438,6 @@ struct rmtacl_ctl_table {
 
 #define EE_HASHES       32
 
-struct eacl_entry {
-	struct list_head	    ee_list;
-	pid_t		 ee_key; /* hash key */
-	struct lu_fid	 ee_fid;
-	int		   ee_type; /* ACL type for ACCESS or DEFAULT */
-	ext_acl_xattr_header *ee_acl;
-};
-
 struct eacl_table {
 	spinlock_t	et_lock;
 	struct list_head	et_entries[EE_HASHES];
@@ -1168,6 +1160,14 @@ void ll_ra_stats_inc(struct address_space *mapping, enum ra_stat which);
 
 /* llite/llite_rmtacl.c */
 #ifdef CONFIG_FS_POSIX_ACL
+struct eacl_entry {
+	struct list_head	    ee_list;
+	pid_t		 ee_key; /* hash key */
+	struct lu_fid	 ee_fid;
+	int		   ee_type; /* ACL type for ACCESS or DEFAULT */
+	ext_acl_xattr_header *ee_acl;
+};
+
 obd_valid rce_ops2valid(int ops);
 struct rmtacl_ctl_entry *rct_search(struct rmtacl_ctl_table *rct, pid_t key);
 int rct_add(struct rmtacl_ctl_table *rct, pid_t key, int ops);
@@ -1183,6 +1183,11 @@ struct eacl_entry *et_search_del(struct eacl_table *et, pid_t key,
 void et_search_free(struct eacl_table *et, pid_t key);
 void et_init(struct eacl_table *et);
 void et_fini(struct eacl_table *et);
+#else
+static inline obd_valid rce_ops2valid(int ops)
+{
+	return 0;
+}
 #endif
 
 /* statahead.c */
drivers/staging/lustre/lustre/llite/xattr.c +2 -0
index 4176264..0a11902 100644
@@ -112,9 +112,11 @@ int ll_setxattr_common(struct inode *inode, const char *name,
 	struct ptlrpc_request *req;
 	int xattr_type, rc;
 	struct obd_capa *oc;
+#ifdef CONFIG_FS_POSIX_ACL
 	posix_acl_xattr_header *new_value = NULL;
 	struct rmtacl_ctl_entry *rce = NULL;
 	ext_acl_xattr_header *acl = NULL;
+#endif
 	const char *pv = value;
 	ENTRY;
 
Signature · 1 line
1.7.9.5
author
#13 lore raw

PATCH v2 11/17 staging/lustre: fix build when CONFIG_UIDGID_STRICT_TYPE_CHECKS is on

In reply to Peng Tao

kuid_t/kgid_t are wrappered when CONFIG_UIDGID_STRICT_TYPE_CHECKS is on. Lustre build is broken because we always treat them as plain __u32. The patch fixes it. Internally, Lustre always use __u32 uid/gid, and convert to kuid_t/kgid_t when necessary.

---
 .../staging/lustre/include/linux/libcfs/curproc.h  |    2 --
 drivers/staging/lustre/lustre/include/linux/lvfs.h |    8 +++----
 drivers/staging/lustre/lustre/include/lustre_cfg.h |    4 ----
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |   16 -------------
 .../lustre/lustre/libcfs/linux/linux-module.c      |    2 +-
 drivers/staging/lustre/lustre/llite/dir.c          |    9 ++++---
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   13 +++++-----
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |    3 ++-
 drivers/staging/lustre/lustre/llite/namei.c        |    7 +++---
 drivers/staging/lustre/lustre/llite/remote_perm.c  |   11 +++++----
 drivers/staging/lustre/lustre/llite/vvp_object.c   |    8 +++----
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   12 +++++-----
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |   25 ++++++++++----------
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    8 ++-----
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    3 ++-
 drivers/staging/lustre/lustre/obdclass/idmap.c     |   12 ++++++----
 .../lustre/lustre/obdclass/linux/linux-obdo.c      |    4 ++--
 drivers/staging/lustre/lustre/obdclass/obdo.c      |   16 ++++++-------
 .../staging/lustre/lustre/obdecho/echo_client.c    |   12 ++++++----
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |   19 ++++++++-------
 20 files changed, 93 insertions(+), 101 deletions(-)
drivers/staging/lustre/include/linux/libcfs/curproc.h +0 -2
index 90d7ce6..de8e35b 100644
@@ -49,8 +49,6 @@
  * Implemented in portals/include/libcfs/<os>/
  */
 int    cfs_curproc_groups_nr(void);
-int    current_is_in_group(gid_t group);
-void   cfs_curproc_groups_dump(gid_t *array, int size);
 
 /*
  * Plus, platform-specific constant
drivers/staging/lustre/lustre/include/linux/lvfs.h +4 -4
index eb59ac7..e61f1b8 100644
@@ -54,10 +54,10 @@
 /* simple.c */
 
 struct lvfs_ucred {
-	__u32		   luc_uid;
-	__u32		   luc_gid;
-	__u32		   luc_fsuid;
-	__u32		   luc_fsgid;
+	kuid_t		luc_uid;
+	kgid_t		luc_gid;
+	kuid_t		luc_fsuid;
+	kgid_t		luc_fsgid;
 	kernel_cap_t	luc_cap;
 	__u32		   luc_umask;
 	struct group_info      *luc_ginfo;
drivers/staging/lustre/lustre/include/lustre_cfg.h +0 -4
index f12429f..fbf94a0 100644
@@ -290,10 +290,6 @@ static inline int lustre_cfg_sanity_check(void *buf, int len)
 
 #include <lustre/lustre_user.h>
 
-#ifndef INVALID_UID
-#define INVALID_UID     (-1)
-#endif
-
 /** @} cfg */
 
 #endif // _LUSTRE_CFG_H
drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +0 -16
index f236510..706dfb3 100644
@@ -65,20 +65,6 @@ int    cfs_curproc_groups_nr(void)
 	return nr;
 }
 
-void   cfs_curproc_groups_dump(gid_t *array, int size)
-{
-	task_lock(current);
-	size = min_t(int, size, current_cred()->group_info->ngroups);
-	memcpy(array, current_cred()->group_info->blocks[0], size * sizeof(__u32));
-	task_unlock(current);
-}
-
-
-int    current_is_in_group(gid_t gid)
-{
-	return in_group_p(gid);
-}
-
 /* Currently all the CFS_CAP_* defines match CAP_* ones. */
 #define cfs_cap_pack(cap) (cap)
 #define cfs_cap_unpack(cap) (cap)
@@ -318,8 +304,6 @@ out:
 EXPORT_SYMBOL(cfs_get_environ);
 
 EXPORT_SYMBOL(cfs_curproc_groups_nr);
-EXPORT_SYMBOL(cfs_curproc_groups_dump);
-EXPORT_SYMBOL(current_is_in_group);
 EXPORT_SYMBOL(cfs_cap_raise);
 EXPORT_SYMBOL(cfs_cap_lower);
 EXPORT_SYMBOL(cfs_cap_raised);
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +1 -1
index 2c7d4a3..6b0054f 100644
@@ -137,7 +137,7 @@ static long libcfs_ioctl(struct file *file,
 	struct cfs_psdev_file	 pfile;
 	int    rc = 0;
 
-	if (current_fsuid() != 0)
+	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
 	if ( _IOC_TYPE(cmd) != IOC_LIBCFS_TYPE ||
drivers/staging/lustre/lustre/llite/dir.c +6 -3
index 13a6426..e2afb97 100644
@@ -685,7 +685,8 @@ int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump,
 
 	op_data->op_cli_flags |= CLI_SET_MEA;
 	err = md_create(sbi->ll_md_exp, op_data, lump, sizeof(*lump), mode,
-			current_fsuid(), current_fsgid(),
+			from_kuid(&init_user_ns, current_fsuid()),
+			from_kgid(&init_user_ns, current_fsgid()),
 			cfs_curproc_cap_pack(), 0, &request);
 	ll_finish_md_op_data(op_data);
 	if (err)
@@ -1105,8 +1106,10 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
 			RETURN(-EPERM);
 		break;
 	case Q_GETQUOTA:
-		if (((type == USRQUOTA && current_euid() != id) ||
-		     (type == GRPQUOTA && !in_egroup_p(id))) &&
+		if (((type == USRQUOTA &&
+		      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) ||
 		     sbi->ll_flags & LL_SBI_RMT_CLIENT))
 			RETURN(-EPERM);
drivers/staging/lustre/lustre/llite/llite_lib.c +7 -6
index afae801..1eb5779 100644
@@ -1400,7 +1400,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
 
 	/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
 	if (attr->ia_valid & TIMES_SET_FLAGS) {
-		if (current_fsuid() != inode->i_uid &&
+		if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
 		    !cfs_capable(CFS_CAP_FOWNER))
 			RETURN(-EPERM);
 	}
@@ -1707,9 +1707,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
 		inode->i_blkbits = inode->i_sb->s_blocksize_bits;
 	}
 	if (body->valid & OBD_MD_FLUID)
-		inode->i_uid = body->uid;
+		inode->i_uid = make_kuid(&init_user_ns, body->uid);
 	if (body->valid & OBD_MD_FLGID)
-		inode->i_gid = body->gid;
+		inode->i_gid = make_kgid(&init_user_ns, body->gid);
 	if (body->valid & OBD_MD_FLFLAGS)
 		inode->i_flags = ll_ext_to_inode_flags(body->flags);
 	if (body->valid & OBD_MD_FLNLINK)
@@ -1959,7 +1959,8 @@ int ll_flush_ctx(struct inode *inode)
 {
 	struct ll_sb_info  *sbi = ll_i2sbi(inode);
 
-	CDEBUG(D_SEC, "flush context for user %d\n", current_uid());
+	CDEBUG(D_SEC, "flush context for user %d\n",
+		      from_kuid(&init_user_ns, current_uid()));
 
 	obd_set_info_async(NULL, sbi->ll_md_exp,
 			   sizeof(KEY_FLUSH_CTX), KEY_FLUSH_CTX,
@@ -2238,8 +2239,8 @@ struct md_op_data * ll_prep_md_op_data(struct md_op_data *op_data,
 	op_data->op_namelen = namelen;
 	op_data->op_mode = mode;
 	op_data->op_mod_time = cfs_time_current_sec();
-	op_data->op_fsuid = current_fsuid();
-	op_data->op_fsgid = current_fsgid();
+	op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
+	op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
 	op_data->op_cap = cfs_curproc_cap_pack();
 	op_data->op_bias = 0;
 	op_data->op_cli_flags = 0;
drivers/staging/lustre/lustre/llite/lproc_llite.c +2 -1
index a30c411..5c7368c 100644
@@ -822,7 +822,8 @@ void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
 		 sbi->ll_stats_track_id == current->parent->pid)
 		lprocfs_counter_add(sbi->ll_stats, op, count);
 	else if (sbi->ll_stats_track_type == STATS_TRACK_GID &&
-		 sbi->ll_stats_track_id == current_gid())
+		 sbi->ll_stats_track_id ==
+			from_kgid(&init_user_ns, current_gid()))
 		lprocfs_counter_add(sbi->ll_stats, op, count);
 }
 EXPORT_SYMBOL(ll_stats_ops_tally);
drivers/staging/lustre/lustre/llite/namei.c +4 -3
index ff8f63d..8e948a7 100644
@@ -302,8 +302,8 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 
 __u32 ll_i2suppgid(struct inode *i)
 {
-	if (current_is_in_group(i->i_gid))
-		return (__u32)i->i_gid;
+	if (in_group_p(i->i_gid))
+		return (__u32)from_kgid(&init_user_ns, i->i_gid);
 	else
 		return (__u32)(-1);
 }
@@ -805,7 +805,8 @@ static int ll_new_node(struct inode *dir, struct qstr *name,
 		GOTO(err_exit, err = PTR_ERR(op_data));
 
 	err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
-			current_fsuid(), current_fsgid(),
+			from_kuid(&init_user_ns, current_fsuid()),
+			from_kgid(&init_user_ns, current_fsgid()),
 			cfs_curproc_cap_pack(), rdev, &request);
 	ll_finish_md_op_data(op_data);
 	if (err)
drivers/staging/lustre/lustre/llite/remote_perm.c +6 -5
index 68b2dc4..4f176e1 100644
@@ -129,17 +129,18 @@ static int do_check_remote_perm(struct ll_inode_info *lli, int mask)
 	if (!lli->lli_remote_perms)
 		RETURN(-ENOENT);
 
-	head = lli->lli_remote_perms + remote_perm_hashfunc(current_uid());
+	head = lli->lli_remote_perms +
+		remote_perm_hashfunc(from_kuid(&init_user_ns, current_uid()));
 
 	spin_lock(&lli->lli_lock);
 	hlist_for_each_entry(lrp, head, lrp_list) {
-		if (lrp->lrp_uid != current_uid())
+		if (lrp->lrp_uid != from_kuid(&init_user_ns, current_uid()))
 			continue;
-		if (lrp->lrp_gid != current_gid())
+		if (lrp->lrp_gid != from_kgid(&init_user_ns, current_gid()))
 			continue;
-		if (lrp->lrp_fsuid != current_fsuid())
+		if (lrp->lrp_fsuid != from_kuid(&init_user_ns, current_fsuid()))
 			continue;
-		if (lrp->lrp_fsgid != current_fsgid())
+		if (lrp->lrp_fsgid != from_kgid(&init_user_ns, current_fsgid()))
 			continue;
 		found = 1;
 		break;
drivers/staging/lustre/lustre/llite/vvp_object.c +4 -4
index 01edc5b..33173fc 100644
@@ -91,8 +91,8 @@ static int vvp_attr_get(const struct lu_env *env, struct cl_object *obj,
 	attr->cat_atime = LTIME_S(inode->i_atime);
 	attr->cat_ctime = LTIME_S(inode->i_ctime);
 	attr->cat_blocks = inode->i_blocks;
-	attr->cat_uid = inode->i_uid;
-	attr->cat_gid = inode->i_gid;
+	attr->cat_uid = from_kuid(&init_user_ns, inode->i_uid);
+	attr->cat_gid = from_kgid(&init_user_ns, inode->i_gid);
 	/* KMS is not known by this layer */
 	return 0; /* layers below have to fill in the rest */
 }
@@ -103,9 +103,9 @@ static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj,
 	struct inode *inode = ccc_object_inode(obj);
 
 	if (valid & CAT_UID)
-		inode->i_uid = attr->cat_uid;
+		inode->i_uid = make_kuid(&init_user_ns, attr->cat_uid);
 	if (valid & CAT_GID)
-		inode->i_gid = attr->cat_gid;
+		inode->i_gid = make_kgid(&init_user_ns, attr->cat_gid);
 	if (valid & CAT_ATIME)
 		LTIME_S(inode->i_atime) = attr->cat_atime;
 	if (valid & CAT_MTIME)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +6 -6
index 1eebfbf..d10f7fc 100644
@@ -1757,8 +1757,8 @@ static int lmv_link(struct obd_export *exp, struct md_op_data *op_data,
 	       PFID(&op_data->op_fid2), op_data->op_namelen,
 	       op_data->op_name, PFID(&op_data->op_fid1));
 
-	op_data->op_fsuid = current_fsuid();
-	op_data->op_fsgid = current_fsgid();
+	op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
+	op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
 	op_data->op_cap = cfs_curproc_cap_pack();
 	tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2);
 	if (IS_ERR(tgt))
@@ -1799,8 +1799,8 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data,
 	if (rc)
 		RETURN(rc);
 
-	op_data->op_fsuid = current_fsuid();
-	op_data->op_fsgid = current_fsgid();
+	op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
+	op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
 	op_data->op_cap = cfs_curproc_cap_pack();
 	src_tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
 	if (IS_ERR(src_tgt))
@@ -2061,8 +2061,8 @@ retry:
 	if (IS_ERR(tgt))
 		RETURN(PTR_ERR(tgt));
 
-	op_data->op_fsuid = current_fsuid();
-	op_data->op_fsgid = current_fsgid();
+	op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
+	op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
 	op_data->op_cap = cfs_curproc_cap_pack();
 
 	/*
drivers/staging/lustre/lustre/mdc/mdc_lib.c +13 -12
index e789aed..2e5c7ce 100644
@@ -45,10 +45,10 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 	LASSERT (b != NULL);
 
 	b->suppgid = suppgid;
-	b->uid = current_uid();
-	b->gid = current_gid();
-	b->fsuid = current_fsuid();
-	b->fsgid = current_fsgid();
+	b->uid = from_kuid(&init_user_ns, current_uid());
+	b->gid = from_kgid(&init_user_ns, current_gid());
+	b->fsuid = from_kuid(&init_user_ns, current_fsuid());
+	b->fsgid = from_kgid(&init_user_ns, current_fsgid());
 	b->capability = cfs_curproc_cap_pack();
 }
 
@@ -219,8 +219,8 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 
 	/* XXX do something about time, uid, gid */
 	rec->cr_opcode   = REINT_OPEN;
-	rec->cr_fsuid   = current_fsuid();
-	rec->cr_fsgid   = current_fsgid();
+	rec->cr_fsuid    = from_kuid(&init_user_ns, current_fsuid());
+	rec->cr_fsgid    = from_kgid(&init_user_ns, current_fsgid());
 	rec->cr_cap      = cfs_curproc_cap_pack();
 	if (op_data != NULL) {
 		rec->cr_fid1 = op_data->op_fid1;
@@ -299,16 +299,16 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
 				 struct md_op_data *op_data)
 {
 	rec->sa_opcode  = REINT_SETATTR;
-	rec->sa_fsuid   = current_fsuid();
-	rec->sa_fsgid   = current_fsgid();
+	rec->sa_fsuid   = from_kuid(&init_user_ns, current_fsuid());
+	rec->sa_fsgid   = from_kgid(&init_user_ns, current_fsgid());
 	rec->sa_cap     = cfs_curproc_cap_pack();
 	rec->sa_suppgid = -1;
 
 	rec->sa_fid    = op_data->op_fid1;
 	rec->sa_valid  = attr_pack(op_data->op_attr.ia_valid);
 	rec->sa_mode   = op_data->op_attr.ia_mode;
-	rec->sa_uid    = op_data->op_attr.ia_uid;
-	rec->sa_gid    = op_data->op_attr.ia_gid;
+	rec->sa_uid    = from_kuid(&init_user_ns, op_data->op_attr.ia_uid);
+	rec->sa_gid    = from_kgid(&init_user_ns, op_data->op_attr.ia_gid);
 	rec->sa_size   = op_data->op_attr.ia_size;
 	rec->sa_blocks = op_data->op_attr_blocks;
 	rec->sa_atime  = LTIME_S(op_data->op_attr.ia_atime);
@@ -316,8 +316,9 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
 	rec->sa_ctime  = LTIME_S(op_data->op_attr.ia_ctime);
 	rec->sa_attr_flags = ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
 	if ((op_data->op_attr.ia_valid & ATTR_GID) &&
-	    current_is_in_group(op_data->op_attr.ia_gid))
-		rec->sa_suppgid = op_data->op_attr.ia_gid;
+	    in_group_p(op_data->op_attr.ia_gid))
+		rec->sa_suppgid =
+			from_kgid(&init_user_ns, op_data->op_attr.ia_gid);
 	else
 		rec->sa_suppgid = op_data->op_suppgids[0];
 
drivers/staging/lustre/lustre/mdc/mdc_request.c +2 -6
index 3cf9d8d..21e8a9d 100644
@@ -377,12 +377,8 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
 			 sizeof(struct mdt_rec_reint));
 		rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 		rec->sx_opcode = REINT_SETXATTR;
-		/* TODO:
-		 *  cfs_curproc_fs{u,g}id() should replace
-		 *  current->fs{u,g}id for portability.
-		 */
-		rec->sx_fsuid  = current_fsuid();
-		rec->sx_fsgid  = current_fsgid();
+		rec->sx_fsuid  = from_kuid(&init_user_ns, current_fsuid());
+		rec->sx_fsgid  = from_kgid(&init_user_ns, current_fsgid());
 		rec->sx_cap    = cfs_curproc_cap_pack();
 		rec->sx_suppgid1 = suppgid;
 		rec->sx_suppgid2 = -1;
drivers/staging/lustre/lustre/obdclass/class_obd.c +2 -1
index 0715cf2..799a1ed 100644
@@ -122,7 +122,8 @@ int lustre_get_jobid(char *jobid)
 	/* Use process name + fsuid as jobid */
 	if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
 		snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
-			 current_comm(), current_fsuid());
+			 current_comm(),
+			 from_kuid(&init_user_ns, current_fsuid()));
 		RETURN(0);
 	}
 
drivers/staging/lustre/lustre/obdclass/idmap.c +8 -4
index 622f8d1..afb66a4 100644
@@ -71,7 +71,8 @@ static int lustre_groups_search(group_info_t *group_info,
 	right = group_info->ngroups;
 	while (left < right) {
 		int mid = (left + right) / 2;
-		int cmp = grp - CFS_GROUP_AT(group_info, mid);
+		int cmp = grp -
+			from_kgid(&init_user_ns, CFS_GROUP_AT(group_info, mid));
 
 		if (cmp > 0)
 			left = mid + 1;
@@ -116,16 +117,19 @@ void lustre_groups_sort(group_info_t *group_info)
 		for (base = 0; base < max; base++) {
 			int left = base;
 			int right = left + stride;
-			gid_t tmp = CFS_GROUP_AT(group_info, right);
+			gid_t tmp = from_kgid(&init_user_ns,
+					      CFS_GROUP_AT(group_info, right));
 
 			while (left >= 0 &&
-			       CFS_GROUP_AT(group_info, left) > tmp) {
+			       tmp < from_kgid(&init_user_ns,
+					       CFS_GROUP_AT(group_info, left))) {
 				CFS_GROUP_AT(group_info, right) =
 				    CFS_GROUP_AT(group_info, left);
 				right = left;
 				left -= stride;
 			}
-			CFS_GROUP_AT(group_info, right) = tmp;
+			CFS_GROUP_AT(group_info, right) =
+						make_kgid(&init_user_ns, tmp);
 		}
 		stride /= 3;
 	}
drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c +2 -2
index 6ee3471..d3bb5ff 100644
@@ -213,9 +213,9 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
 	if (valid & OBD_MD_FLMODE)
 		dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
 	if (valid & OBD_MD_FLUID)
-		dst->i_uid = src->o_uid;
+		dst->i_uid = make_kuid(&init_user_ns, src->o_uid);
 	if (valid & OBD_MD_FLGID)
-		dst->i_gid = src->o_gid;
+		dst->i_gid = make_kgid(&init_user_ns, src->o_gid);
 	if (valid & OBD_MD_FLFLAGS)
 		dst->i_flags = src->o_flags;
 }
drivers/staging/lustre/lustre/obdclass/obdo.c +8 -8
index 01a0e1f..7099764 100644
@@ -100,11 +100,11 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
 		newvalid |= OBD_MD_FLMODE;
 	}
 	if (valid & OBD_MD_FLUID) {
-		dst->o_uid = src->i_uid;
+		dst->o_uid = from_kuid(&init_user_ns, src->i_uid);
 		newvalid |= OBD_MD_FLUID;
 	}
 	if (valid & OBD_MD_FLGID) {
-		dst->o_gid = src->i_gid;
+		dst->o_gid = from_kgid(&init_user_ns, src->i_gid);
 		newvalid |= OBD_MD_FLGID;
 	}
 	if (valid & OBD_MD_FLFLAGS) {
@@ -232,16 +232,16 @@ void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
 	if (ia_valid & ATTR_MODE) {
 		oa->o_mode = attr->ia_mode;
 		oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
-		if (!current_is_in_group(oa->o_gid) &&
+		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
 		    !cfs_capable(CFS_CAP_FSETID))
 			oa->o_mode &= ~S_ISGID;
 	}
 	if (ia_valid & ATTR_UID) {
-		oa->o_uid = attr->ia_uid;
+		oa->o_uid = from_kuid(&init_user_ns, attr->ia_uid);
 		oa->o_valid |= OBD_MD_FLUID;
 	}
 	if (ia_valid & ATTR_GID) {
-		oa->o_gid = attr->ia_gid;
+		oa->o_gid = from_kgid(&init_user_ns, attr->ia_gid);
 		oa->o_valid |= OBD_MD_FLGID;
 	}
 }
@@ -281,16 +281,16 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid)
 	if (valid & OBD_MD_FLMODE) {
 		attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
 		attr->ia_valid |= ATTR_MODE;
-		if (!current_is_in_group(oa->o_gid) &&
+		if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
 		    !cfs_capable(CFS_CAP_FSETID))
 			attr->ia_mode &= ~S_ISGID;
 	}
 	if (valid & OBD_MD_FLUID) {
-		attr->ia_uid = oa->o_uid;
+		attr->ia_uid = make_kuid(&init_user_ns, oa->o_uid);
 		attr->ia_valid |= ATTR_UID;
 	}
 	if (valid & OBD_MD_FLGID) {
-		attr->ia_gid = oa->o_gid;
+		attr->ia_gid = make_kgid(&init_user_ns, oa->o_gid);
 		attr->ia_valid |= ATTR_GID;
 	}
 }
drivers/staging/lustre/lustre/obdecho/echo_client.c +8 -4
index 184195f..ae89ea6f 100644
@@ -2097,10 +2097,14 @@ static void echo_ucred_init(struct lu_env *env)
 	ucred->uc_suppgids[0] = -1;
 	ucred->uc_suppgids[1] = -1;
 
-	ucred->uc_uid   = ucred->uc_o_uid   = current_uid();
-	ucred->uc_gid   = ucred->uc_o_gid   = current_gid();
-	ucred->uc_fsuid = ucred->uc_o_fsuid = current_fsuid();
-	ucred->uc_fsgid = ucred->uc_o_fsgid = current_fsgid();
+	ucred->uc_uid   = ucred->uc_o_uid   =
+				from_kuid(&init_user_ns, current_uid());
+	ucred->uc_gid   = ucred->uc_o_gid   =
+				from_kgid(&init_user_ns, current_gid());
+	ucred->uc_fsuid = ucred->uc_o_fsuid =
+				from_kuid(&init_user_ns, current_fsuid());
+	ucred->uc_fsgid = ucred->uc_o_fsgid =
+				from_kgid(&init_user_ns, current_fsgid());
 	ucred->uc_cap   = cfs_curproc_cap_pack();
 
 	/* remove fs privilege for non-root user. */
drivers/staging/lustre/lustre/ptlrpc/sec.c +10 -9
index 36e8bed..349c57b 100644
@@ -269,8 +269,8 @@ struct ptlrpc_cli_ctx *get_my_ctx(struct ptlrpc_sec *sec)
 			remove_dead = 0;
 		}
 	} else {
-		vcred.vc_uid = current_uid();
-		vcred.vc_gid = current_gid();
+		vcred.vc_uid = from_kuid(&init_user_ns, current_uid());
+		vcred.vc_gid = from_kgid(&init_user_ns, current_gid());
 	}
 
 	return sec->ps_policy->sp_cops->lookup_ctx(sec, &vcred,
@@ -1523,7 +1523,8 @@ void sptlrpc_import_flush_root_ctx(struct obd_import *imp)
 
 void sptlrpc_import_flush_my_ctx(struct obd_import *imp)
 {
-	import_flush_ctx_common(imp, current_uid(), 1, 1);
+	import_flush_ctx_common(imp, from_kuid(&init_user_ns, current_uid()),
+				1, 1);
 }
 EXPORT_SYMBOL(sptlrpc_import_flush_my_ctx);
 
@@ -2055,8 +2056,8 @@ int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
 
 	req->rq_flvr.sf_rpc = WIRE_FLVR(msg->lm_secflvr);
 	req->rq_sp_from = LUSTRE_SP_ANY;
-	req->rq_auth_uid = INVALID_UID;
-	req->rq_auth_mapped_uid = INVALID_UID;
+	req->rq_auth_uid = -1;
+	req->rq_auth_mapped_uid = -1;
 
 	policy = sptlrpc_wireflavor2policy(req->rq_flvr.sf_rpc);
 	if (!policy) {
@@ -2314,10 +2315,10 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset)
 
 	pud = lustre_msg_buf(msg, offset, 0);
 
-	pud->pud_uid = current_uid();
-	pud->pud_gid = current_gid();
-	pud->pud_fsuid = current_fsuid();
-	pud->pud_fsgid = current_fsgid();
+	pud->pud_uid = from_kuid(&init_user_ns, current_uid());
+	pud->pud_gid = from_kgid(&init_user_ns, current_gid());
+	pud->pud_fsuid = from_kuid(&init_user_ns, current_fsuid());
+	pud->pud_fsgid = from_kgid(&init_user_ns, current_fsgid());
 	pud->pud_cap = cfs_curproc_cap_pack();
 	pud->pud_ngroups = (msg->lm_buflens[offset] - sizeof(*pud)) / 4;
 
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH v2 12/17 staging/lustre: fix build error on non-x86 platforms

In reply to Peng Tao

dump_trace() is only available on X86. Without it, Lustre's own watchdog is broken. We can only dump current task's stack.

The client-side this code is much less likely to hit deadlocks and it's probably OK to drop this altogether, since we hardly have any ptlrpc threads on clients, most notable ones are ldlm cb threads that should not really be blocking on the client anyway.

Remove libcfs watchdog for now, until the upstream kernel watchdog can detect distributed deadlocks and dump other kernel threads.

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   25 -
 .../lustre/include/linux/libcfs/libcfs_private.h   |    1 -
 drivers/staging/lustre/lustre/include/linux/obd.h  |    5 +-
 drivers/staging/lustre/lustre/include/lustre_net.h |    7 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     |    2 +-
 drivers/staging/lustre/lustre/libcfs/Makefile      |    2 +-
 .../lustre/lustre/libcfs/linux/linux-debug.c       |   45 +-
 drivers/staging/lustre/lustre/libcfs/watchdog.c    |  516 --------------------
 drivers/staging/lustre/lustre/llite/dcache.c       |    2 +-
 drivers/staging/lustre/lustre/llite/rw.c           |    2 +-
 drivers/staging/lustre/lustre/osc/osc_io.c         |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c     |    8 +
 12 files changed, 21 insertions(+), 596 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/watchdog.c
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -25
index 1ab1f2b..2983ce4 100644
@@ -117,31 +117,6 @@ int libcfs_sock_write(socket_t *sock, void *buffer, int nob, int timeout);
 int libcfs_sock_read(socket_t *sock, void *buffer, int nob, int timeout);
 void libcfs_sock_release(socket_t *sock);
 
-/* libcfs watchdogs */
-struct lc_watchdog;
-
-/* Add a watchdog which fires after "time" milliseconds of delay.  You have to
- * touch it once to enable it. */
-struct lc_watchdog *lc_watchdog_add(int time,
-				    void (*cb)(pid_t pid, void *),
-				    void *data);
-
-/* Enables a watchdog and resets its timer. */
-void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout);
-#define CFS_GET_TIMEOUT(svc) (max_t(int, obd_timeout,		   \
-			  AT_OFF ? 0 : at_get(&svc->srv_at_estimate)) * \
-			  svc->srv_watchdog_factor)
-
-/* Disable a watchdog; touch it to restart it. */
-void lc_watchdog_disable(struct lc_watchdog *lcw);
-
-/* Clean up the watchdog */
-void lc_watchdog_delete(struct lc_watchdog *lcw);
-
-/* Dump a debug log */
-void lc_watchdog_dumplog(pid_t pid, void *data);
-
-
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +0 -1
index 056caa4..62ef8a7 100644
@@ -210,7 +210,6 @@ do {								    \
 #define ntohs(x) ___ntohs(x)
 #endif
 
-void libcfs_debug_dumpstack(task_t *tsk);
 void libcfs_run_upcall(char **argv);
 void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data *);
 void libcfs_debug_dumplog(void);
drivers/staging/lustre/lustre/include/linux/obd.h +1 -4
index 2c36c0d..01a5026 100644
@@ -93,11 +93,8 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,
 				      lock, task->comm, task->pid,
 				      lock->func, lock->line,
 				      (jiffies - lock->time) / HZ);
-			LCONSOLE_WARN("====== for process holding the "
-				      "lock =====\n");
-			libcfs_debug_dumpstack(task);
 			LCONSOLE_WARN("====== for current process =====\n");
-			libcfs_debug_dumpstack(NULL);
+			dump_stack();
 			LCONSOLE_WARN("====== end =======\n");
 			cfs_pause(1000 * HZ);
 		}
drivers/staging/lustre/lustre/include/lustre_net.h +6 -1
index 293dd90..1b99b5d 100644
@@ -2322,8 +2322,13 @@ struct ptlrpc_thread {
 	pid_t t_pid;
 	/**
 	 * put watchdog in the structure per thread b=14840
+	 *
+	 * Lustre watchdog is removed for client in the hope
+	 * of a generic watchdog can be merged in kernel.
+	 * When that happens, we should add below back.
+	 *
+	 * struct lc_watchdog *t_watchdog;
 	 */
-	struct lc_watchdog *t_watchdog;
 	/**
 	 * the svc this thread belonged to b=18582
 	 */
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
index 33b76a1..93badf5 100644
@@ -1548,7 +1548,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
 		break;
 	default:
 		LDLM_ERROR(lock, "Unknown LVB type: %d\n", lock->l_lvb_type);
-		libcfs_debug_dumpstack(NULL);
+		dump_stack();
 		RETURN(-EINVAL);
 	}
 
drivers/staging/lustre/lustre/libcfs/Makefile +1 -1
index bf5c563..6e489d7 100644
@@ -11,7 +11,7 @@ libcfs-linux-objs += linux-crypto-adler.o
 libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
 
 libcfs-all-objs := debug.o fail.o nidstrings.o module.o tracefile.o \
-		   watchdog.o libcfs_string.o hash.o kernel_user_comm.o \
+		   libcfs_string.o hash.o kernel_user_comm.o \
 		   prng.o workitem.o upcall_cache.o libcfs_cpu.o \
 		   libcfs_mem.o libcfs_lock.o
 
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +1 -44

63 lines not on this page · raw message

drivers/staging/lustre/lustre/libcfs/watchdog.c deleted +0 -516

516 lines not on this page · raw message

drivers/staging/lustre/lustre/llite/dcache.c +1 -1
index ff0d085..40b0f3b 100644
@@ -300,7 +300,7 @@ void ll_invalidate_aliases(struct inode *inode)
 			CERROR("called on root (?) dentry=%p, inode=%p "
 			       "ino=%lu\n", dentry, inode, inode->i_ino);
 			lustre_dump_dentry(dentry, 1);
-			libcfs_debug_dumpstack(NULL);
+			dump_stack();
 		}
 
 		d_lustre_invalidate(dentry, 0);
drivers/staging/lustre/lustre/llite/rw.c +1 -1
index fac1178..f48766e 100644
@@ -132,7 +132,7 @@ static struct ll_cl_context *ll_cl_init(struct file *file,
 			 * add dirty pages into cache during truncate */
 			CERROR("Proc %s is dirting page w/o inode lock, this"
 			       "will break truncate.\n", current->comm);
-			libcfs_debug_dumpstack(NULL);
+			dump_stack();
 			LBUG();
 			return ERR_PTR(-EIO);
 		}
drivers/staging/lustre/lustre/osc/osc_io.c +1 -1
index 1b27704..70aad1a 100644
@@ -785,7 +785,7 @@ static void osc_req_attr_set(const struct lu_env *env,
 					      "no cover page!\n");
 			CL_PAGE_DEBUG(D_ERROR, env, apage,
 				      "dump uncover page!\n");
-			libcfs_debug_dumpstack(NULL);
+			dump_stack();
 			LBUG();
 		}
 
drivers/staging/lustre/lustre/ptlrpc/service.c +8 -0
index cd1bab5..6871711 100644
@@ -2254,7 +2254,9 @@ ptlrpc_wait_event(struct ptlrpc_service_part *svcpt,
 	struct l_wait_info lwi = LWI_TIMEOUT(svcpt->scp_rqbd_timeout,
 					     ptlrpc_retry_rqbds, svcpt);
 
+	/* XXX: Add this back when libcfs watchdog is merged upstream
 	lc_watchdog_disable(thread->t_watchdog);
+	 */
 
 	cond_resched();
 
@@ -2268,8 +2270,10 @@ ptlrpc_wait_event(struct ptlrpc_service_part *svcpt,
 	if (ptlrpc_thread_stopping(thread))
 		return -EINTR;
 
+	/*
 	lc_watchdog_touch(thread->t_watchdog,
 			  ptlrpc_server_get_timeout(svcpt));
+	 */
 	return 0;
 }
 
@@ -2372,8 +2376,10 @@ static int ptlrpc_main(void *arg)
 	/* wake up our creator in case he's still waiting. */
 	wake_up(&thread->t_ctl_waitq);
 
+	/*
 	thread->t_watchdog = lc_watchdog_add(ptlrpc_server_get_timeout(svcpt),
 					     NULL, NULL);
+	 */
 
 	spin_lock(&svcpt->scp_rep_lock);
 	list_add(&rs->rs_list, &svcpt->scp_rep_idle);
@@ -2428,8 +2434,10 @@ static int ptlrpc_main(void *arg)
 		}
 	}
 
+	/*
 	lc_watchdog_delete(thread->t_watchdog);
 	thread->t_watchdog = NULL;
+	*/
 
 out_srv_fini:
 	/*
Signature · 1 line
1.7.9.5
author
#15 lore raw

PATCH v2 13/17 staging/lustre: fix build warnning on 32bit system

In reply to Peng Tao

Building on 32bit system, I got warnings like below:
drivers/staging/lustre/lustre/llite/../include/lprocfs_status.h:666:7: note: expected ‘long unsigned int *’ but argument is of type ‘size_t *’
char *lprocfs_find_named_value(const char *buffer, const char *name,

drivers/staging/lustre/lustre/lov/lov_io.c: In function ‘lov_io_rw_iter_init’:
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \

---
 .../staging/lustre/lustre/include/lprocfs_status.h |    4 ++--
 drivers/staging/lustre/lustre/lov/lov_io.c         |    2 +-
 .../lustre/lustre/obdclass/lprocfs_status.c        |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lprocfs_status.h +2 -2
index 55f1822..294fb78 100644
@@ -663,8 +663,8 @@ extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
 extern int lprocfs_write_frac_u64_helper(const char *buffer,
 					 unsigned long count,
 					 __u64 *val, int mult);
-char *lprocfs_find_named_value(const char *buffer, const char *name,
-				unsigned long *count);
+extern char *lprocfs_find_named_value(const char *buffer, const char *name,
+				      size_t *count);
 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
 void lprocfs_oh_clear(struct obd_histogram *oh);
drivers/staging/lustre/lustre/lov/lov_io.c +1 -1
index 1a87abd..022e0f4 100644
@@ -430,7 +430,7 @@ static int lov_io_rw_iter_init(const struct lu_env *env,
 	struct lov_io	*lio = cl2lov_io(env, ios);
 	struct cl_io	 *io  = ios->cis_io;
 	struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;
-	loff_t start = io->u.ci_rw.crw_pos;
+	__u64 start = io->u.ci_rw.crw_pos;
 	loff_t next;
 	unsigned long ssize = lsm->lsm_stripe_size;
 
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
index f7af3d6..85163f4 100644
@@ -1873,7 +1873,7 @@ static char *lprocfs_strnstr(const char *s1, const char *s2, size_t len)
  * If \a name is not found the original \a buffer is returned.
  */
 char *lprocfs_find_named_value(const char *buffer, const char *name,
-				unsigned long *count)
+			       size_t *count)
 {
 	char *val;
 	size_t buflen = *count;
Signature · 1 line
1.7.9.5
author
#16 lore raw

PATCH v2 14/17 staging/lustre: fix for invalidatepage() API change

In reply to Peng Tao

From: Stephen Rothwell <[email protected]>

somehow this got dropped during merge window...

---
 .../lustre/include/linux/lustre_patchless_compat.h |    2 +-
 drivers/staging/lustre/lustre/llite/rw26.c         |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +1 -1
index a8e9c0c..a260e99 100644
@@ -53,7 +53,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
 		return;
 
 	if (PagePrivate(page))
-		page->mapping->a_ops->invalidatepage(page, 0);
+		page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE);
 
 	cancel_dirty_page(page, PAGE_SIZE);
 	ClearPageMappedToDisk(page);
drivers/staging/lustre/lustre/llite/rw26.c +3 -2
index 27e4e64..f1a1c5f 100644
@@ -72,7 +72,8 @@
  * aligned truncate). Lustre leaves partially truncated page in the cache,
  * relying on struct inode::i_size to limit further accesses.
  */
-static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
+static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
+			      unsigned int length)
 {
 	struct inode     *inode;
 	struct lu_env    *env;
@@ -89,7 +90,7 @@ static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
 	 * below because they are run with page locked and all our io is
 	 * happening with locked page too
 	 */
-	if (offset == 0) {
+	if (offset == 0 && length == PAGE_CACHE_SIZE) {
 		env = cl_env_get(&refcheck);
 		if (!IS_ERR(env)) {
 			inode = vmpage->mapping->host;
Signature · 1 line
1.7.9.5
author
#17 lore raw

PATCH v2 15/17 staging/lustre/llite: fix for d_compare API change

In reply to Peng Tao

From: Peng Tao <[email protected]>

---
 drivers/staging/lustre/lustre/llite/dcache.c       |    3 +--
 .../staging/lustre/lustre/llite/llite_internal.h   |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +1 -2
index 40b0f3b..a160a84 100644
@@ -84,8 +84,7 @@ static void ll_release(struct dentry *de)
  * an AST before calling d_revalidate_it().  The dentry still exists (marked
  * INVALID) so d_lookup() matches it, but we have no lock on it (so
  * lock_match() fails) and we spin around real_lookup(). */
-int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
-		const struct dentry *dentry, const struct inode *inode,
+int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
 		unsigned int len, const char *str, const struct qstr *name)
 {
 	ENTRY;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -2
index 1069b8d..cbcd118 100644
@@ -784,8 +784,7 @@ void ll_intent_release(struct lookup_intent *);
 void ll_invalidate_aliases(struct inode *);
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);
 void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
-int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
-		const struct dentry *dentry, const struct inode *inode,
+int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
 		unsigned int len, const char *str, const struct qstr *d_name);
 int ll_revalidate_it_finish(struct ptlrpc_request *request,
 			    struct lookup_intent *it, struct dentry *de);
Signature · 1 line
1.7.9.5
author
#18 lore raw

PATCH v2 16/17 staging/lustre/llite: readdir convert to iterate

In reply to Peng Tao

From: Peng Tao <[email protected]>

---
 drivers/staging/lustre/lustre/llite/dir.c          |   45 +++++++++-----------
 .../staging/lustre/lustre/llite/llite_internal.h   |    4 +-
 drivers/staging/lustre/lustre/llite/llite_nfs.c    |   13 +++---
 3 files changed, 28 insertions(+), 34 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +20 -25
index e2afb97..1084999 100644
@@ -483,12 +483,11 @@ fail:
 	goto out_unlock;
 }
 
-int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
-		filldir_t filldir)
+int ll_dir_read(struct inode *inode, struct dir_context *ctx)
 {
 	struct ll_inode_info *info       = ll_i2info(inode);
 	struct ll_sb_info    *sbi	= ll_i2sbi(inode);
-	__u64		 pos	= *_pos;
+	__u64		   pos		= ctx->pos;
 	int		   api32      = ll_need_32bit_api(sbi);
 	int		   hash64     = sbi->ll_flags & LL_SBI_64BIT_HASH;
 	struct page	  *page;
@@ -548,12 +547,14 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
 				fid_le_to_cpu(&fid, &ent->lde_fid);
 				ino = cl_fid_build_ino(&fid, api32);
 				type = ll_dirent_type_get(ent);
+				ctx->pos = lhash;
 				/* For 'll_nfs_get_name_filldir()', it will try
 				 * to access the 'ent' through its 'lde_name',
-				 * so the parameter 'name' for 'filldir()' must
-				 * be part of the 'ent'. */
-				done = filldir(cookie, ent->lde_name, namelen,
-					       lhash, ino, type);
+				 * so the parameter 'name' for 'ctx->actor()'
+				 * must be part of the 'ent'.
+				 */
+				done = !dir_emit(ctx, ent->lde_name,
+						 namelen, ino, type);
 			}
 			next = le64_to_cpu(dp->ldp_hash_end);
 			if (!done) {
@@ -594,50 +595,44 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
 		}
 	}
 
-	*_pos = pos;
+	ctx->pos = pos;
 	ll_dir_chain_fini(&chain);
 	RETURN(rc);
 }
 
-static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
+static int ll_readdir(struct file *filp, struct dir_context *ctx)
 {
 	struct inode		*inode	= filp->f_dentry->d_inode;
 	struct ll_file_data	*lfd	= LUSTRE_FPRIVATE(filp);
 	struct ll_sb_info	*sbi	= ll_i2sbi(inode);
-	__u64			pos	= lfd->lfd_pos;
 	int			hash64	= sbi->ll_flags & LL_SBI_64BIT_HASH;
 	int			api32	= ll_need_32bit_api(sbi);
 	int			rc;
-	struct path		path;
 	ENTRY;
 
 	CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu "
 	       " 32bit_api %d\n", inode->i_ino, inode->i_generation,
-	       inode, (unsigned long)pos, i_size_read(inode), api32);
+	       inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
 
-	if (pos == MDS_DIR_END_OFF)
+	if (lfd->lfd_pos == MDS_DIR_END_OFF)
 		/*
 		 * end-of-file.
 		 */
 		GOTO(out, rc = 0);
 
-	rc = ll_dir_read(inode, &pos, cookie, filldir);
-	lfd->lfd_pos = pos;
-	if (pos == MDS_DIR_END_OFF) {
+	ctx->pos = lfd->lfd_pos;
+	rc = ll_dir_read(inode, ctx);
+	lfd->lfd_pos = ctx->pos;
+	if (ctx->pos == MDS_DIR_END_OFF) {
 		if (api32)
-			filp->f_pos = LL_DIR_END_OFF_32BIT;
+			ctx->pos = LL_DIR_END_OFF_32BIT;
 		else
-			filp->f_pos = LL_DIR_END_OFF;
+			ctx->pos = LL_DIR_END_OFF;
 	} else {
 		if (api32 && hash64)
-			filp->f_pos = pos >> 32;
-		else
-			filp->f_pos = pos;
+			ctx->pos >>= 32;
 	}
 	filp->f_version = inode->i_version;
-	path.mnt = filp->f_path.mnt;
-	path.dentry = filp->f_dentry;
-	touch_atime(&path);
 
 out:
 	if (!rc)
@@ -1976,7 +1971,7 @@ struct file_operations ll_dir_operations = {
 	.open     = ll_dir_open,
 	.release  = ll_dir_release,
 	.read     = generic_read_dir,
-	.readdir  = ll_readdir,
+	.iterate  = ll_readdir,
 	.unlocked_ioctl   = ll_dir_ioctl,
 	.fsync    = ll_fsync,
 };
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
index cbcd118..0534665 100644
@@ -90,6 +90,7 @@ extern struct file_operations ll_pgcache_seq_fops;
 #define REMOTE_PERM_HASHSIZE 16
 
 struct ll_getname_data {
+	struct dir_context ctx;
 	char	    *lgd_name;      /* points to a buffer with NAME_MAX+1 size */
 	struct lu_fid    lgd_fid;       /* target fid we are looking for */
 	int	      lgd_found;     /* inode matched? */
@@ -679,8 +680,7 @@ extern struct file_operations ll_dir_operations;
 extern struct inode_operations ll_dir_inode_operations;
 struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
 			     struct ll_dir_chain *chain);
-int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
-		filldir_t filldir);
+int ll_dir_read(struct inode *inode, struct dir_context *ctx);
 
 int ll_get_mdt_idx(struct inode *inode);
 /* llite/namei.c */
drivers/staging/lustre/lustre/llite/llite_nfs.c +6 -7
index 28cc41e..f142a1e 100644
@@ -214,9 +214,12 @@ static int ll_get_name(struct dentry *dentry, char *name,
 		       struct dentry *child)
 {
 	struct inode *dir = dentry->d_inode;
-	struct ll_getname_data lgd;
-	__u64 offset = 0;
 	int rc;
+	struct ll_getname_data lgd = {
+		.lgd_name = name,
+		.lgd_fid = ll_i2info(child->d_inode)->lli_fid,
+		.ctx.actor = ll_nfs_get_name_filldir,
+	};
 	ENTRY;
 
 	if (!dir || !S_ISDIR(dir->i_mode))
@@ -225,12 +228,8 @@ static int ll_get_name(struct dentry *dentry, char *name,
 	if (!dir->i_fop)
 		GOTO(out, rc = -EINVAL);
 
-	lgd.lgd_name = name;
-	lgd.lgd_fid = ll_i2info(child->d_inode)->lli_fid;
-	lgd.lgd_found = 0;
-
 	mutex_lock(&dir->i_mutex);
-	rc = ll_dir_read(dir, &offset, &lgd, ll_nfs_get_name_filldir);
+	rc = ll_dir_read(dir, &lgd.ctx);
 	mutex_unlock(&dir->i_mutex);
 	if (!rc && !lgd.lgd_found)
 		rc = -ENOENT;
Signature · 1 line
1.7.9.5
author
#19 lore raw

PATCH v2 17/17 staging/lustre: drop CONFIG_BROKEN

In reply to Peng Tao

This reverts commit 0ad1ea69545b1965be4c93ee03fdc685c6beb23d

I didn't use git revert because it can not be done cleanly. Hopefully it will be the last time we do it...

---
 drivers/staging/lustre/lustre/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/Kconfig +1 -1
index c59ea55..893a3c6 100644
@@ -1,6 +1,6 @@
 config LUSTRE_FS
 	tristate "Lustre file system client support"
-	depends on STAGING && INET && m && BROKEN
+	depends on STAGING && INET && m
 	select LNET
 	select CRYPTO
 	select CRYPTO_CRC32
Signature · 1 line
1.7.9.5