From: "Justin Lecher" <jlec@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sci:master commit in: sys-cluster/lustre/, sys-cluster/lustre/files/
Date: Thu, 11 Jul 2013 15:36:40 +0000 (UTC) [thread overview]
Message-ID: <1373556893.763e1015c20a1be5543596f3f7a25afcee576e9a.jlec@gentoo> (raw)
commit: 763e1015c20a1be5543596f3f7a25afcee576e9a
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 11 13:24:22 2013 +0000
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Thu Jul 11 15:34:53 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=763e1015
Update lustre patches
Package-Manager: portage-2.2.0_alpha186
---
sys-cluster/lustre/ChangeLog | 20 +
...01-LU-1812-kernel-3.7-FC18-server-patches.patch | 380 ---
...d-make-AC-check-for-linux-arch-sandbox-f.patch} | 8 +-
...-kernel-Kernel-update-for-3.7.2-201.fc18.patch} | 105 +-
...nel-sock_map_fd-replaced-by-sock_alloc_fi.patch | 137 -
...nel-3.9-hlist_for_each_entry-uses-3-args.patch} | 30 +-
...pat-posix_acl_-to-from-_xattr-take-user_n.patch | 159 --
...9-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch} | 14 +-
...005-LU-2800-llite-introduce-local-getname.patch | 91 -
.../files/0006-LU-2987-llite-rcu-free-inode.patch | 89 -
...50-kernel-3.8-upstream-removes-vmtruncate.patch | 83 -
...-2850-kernel-3.8-upstream-kills-daemonize.patch | 3005 --------------------
...uild-fix-compilation-error-with-gcc-4.7.2.patch | 43 -
sys-cluster/lustre/lustre-9999.ebuild | 16 +-
14 files changed, 96 insertions(+), 4084 deletions(-)
diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog
index 9d8c772..b769d9b 100644
--- a/sys-cluster/lustre/ChangeLog
+++ b/sys-cluster/lustre/ChangeLog
@@ -2,6 +2,26 @@
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 11 Jul 2013; Alexey Shvetsov <alexxy@gentoo.org>
+ +files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch,
+ +files/0002-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch,
+ +files/0003-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch,
+ +files/0004-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch,
+ -files/0001-LU-1812-kernel-3.7-FC18-server-patches.patch,
+ -files/0002-LU-2686-kernel-sock_map_fd-replaced-by-sock_alloc_fi.patch,
+ -files/0003-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch,
+ -files/0004-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch,
+ -files/0005-LU-2800-llite-introduce-local-getname.patch,
+ -files/0006-LU-2987-llite-rcu-free-inode.patch,
+ -files/0007-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch,
+ -files/0008-LU-2850-kernel-3.8-upstream-kills-daemonize.patch,
+ -files/0009-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch,
+ -files/0010-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch,
+ -files/0011-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch,
+ -files/0012-LU-3179-build-fix-compilation-error-with-gcc-4.7.2.patch,
+ lustre-9999.ebuild:
+ Update lustre patches
+
13 Jun 2013; Justin Lecher <jlec@gentoo.org> lustre-9999.ebuild,
metadata.xml:
Move virtual/linux-sources to build deps
diff --git a/sys-cluster/lustre/files/0001-LU-1812-kernel-3.7-FC18-server-patches.patch b/sys-cluster/lustre/files/0001-LU-1812-kernel-3.7-FC18-server-patches.patch
deleted file mode 100644
index f773a7b..0000000
--- a/sys-cluster/lustre/files/0001-LU-1812-kernel-3.7-FC18-server-patches.patch
+++ /dev/null
@@ -1,380 +0,0 @@
-From 91315157587f3392b6cf43ea286b0f3ce1e7f94f Mon Sep 17 00:00:00 2001
-From: James Simmons <uja.ornl@gmail.com>
-Date: Thu, 2 May 2013 07:54:50 -0400
-Subject: [PATCH 01/12] LU-1812 kernel: 3.7/FC18 server patches
-
-This patch extends lustre server support to FC18 running a
-3.7.2-201 kernel with a ZFS backend. At this time ldiskfs
-is not supported on FC18. This patch provides block level
-performance optimizations and the ability to simulate fail
-over for ldiskfs when it is provided. The jbd2-jcberr patch
-was not ported to these new platforms for reasons described
-in LU-433.
-
-Signed-off-by: James Simmons <uja.ornl@gmail.com>
-Change-Id: I2a86d7ca4e068686372eb74f85b1443d24e245c4
----
- .../patches/blkdev_tunables-3.7.patch | 128 +++++++++++++++
- .../kernel_patches/patches/dev_read_only-3.7.patch | 174 +++++++++++++++++++++
- .../patches/raid5-mmp-unplug-dev-3.7.patch | 21 +++
- lustre/kernel_patches/series/3.x-fc18.series | 4 +
- 4 files changed, 327 insertions(+)
- create mode 100644 lustre/kernel_patches/patches/blkdev_tunables-3.7.patch
- create mode 100644 lustre/kernel_patches/patches/dev_read_only-3.7.patch
- create mode 100644 lustre/kernel_patches/patches/raid5-mmp-unplug-dev-3.7.patch
- create mode 100644 lustre/kernel_patches/series/3.x-fc18.series
-
-diff --git a/lustre/kernel_patches/patches/blkdev_tunables-3.7.patch b/lustre/kernel_patches/patches/blkdev_tunables-3.7.patch
-new file mode 100644
-index 0000000..1a98fb5
---- /dev/null
-+++ b/lustre/kernel_patches/patches/blkdev_tunables-3.7.patch
-@@ -0,0 +1,128 @@
-+--- a/block/blk-settings.c 2013-02-06 12:40:44.000000000 -0500
-++++ b/block/blk-settings.c 2013-02-06 12:55:28.000000000 -0500
-+@@ -19,6 +19,12 @@
-+
-+ unsigned long blk_max_pfn;
-+
-++int default_max_sectors = BLK_DEF_MAX_SECTORS;
-++module_param(default_max_sectors, int, 0);
-++
-++int default_max_segments = BLK_MAX_SEGMENTS;
-++module_param(default_max_segments, int, 0);
-++
-+ /**
-+ * blk_queue_prep_rq - set a prepare_request function for queue
-+ * @q: queue
-+@@ -108,7 +114,7 @@
-+ */
-+ void blk_set_default_limits(struct queue_limits *lim)
-+ {
-+- lim->max_segments = BLK_MAX_SEGMENTS;
-++ lim->max_segments = default_max_segments;
-+ lim->max_integrity_segments = 0;
-+ lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
-+ lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
-+@@ -255,7 +261,7 @@
-+
-+ limits->max_hw_sectors = max_hw_sectors;
-+ limits->max_sectors = min_t(unsigned int, max_hw_sectors,
-+- BLK_DEF_MAX_SECTORS);
-++ default_max_sectors);
-+ }
-+ EXPORT_SYMBOL(blk_limits_max_hw_sectors);
-+
-+--- a/drivers/scsi/Kconfig 2013-02-07 09:25:49.000000000 -0500
-++++ b/drivers/scsi/Kconfig 2013-02-07 09:30:15.000000000 -0500
-+@@ -245,6 +245,15 @@ config SCSI_SCAN_ASYNC
-+ there should be no noticeable performance impact as long as you have
-+ logging turned off.
-+
-++config SCSI_MAX_SG_SEGMENTS
-++ int "Maximum SCSI scatter gather segment size"
-++ range 32 256
-++ default "128"
-++ depends on SCSI
-++ help
-++ Control the maximum limit for scatter gather buffers for the
-++ SCSI device.
-++
-+ config SCSI_SCAN_ASYNC
-+ bool "Asynchronous SCSI scanning"
-+ depends on SCSI
-+--- a/include/scsi/scsi.h 2013-02-07 09:55:02.000000000 -0500
-++++ b/include/scsi/scsi.h 2013-02-07 09:55:20.000000000 -0500
-+@@ -20,7 +20,7 @@ struct scsi_cmnd;
-+ * to SG_MAX_SINGLE_ALLOC to pack correctly at the highest order. The
-+ * minimum value is 32
-+ */
-+-#define SCSI_MAX_SG_SEGMENTS 128
-++#define SCSI_MAX_SG_SEGMENTS CONFIG_SCSI_MAX_SG_SEGMENTS
-+
-+ /*
-+ * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
-+--- a/drivers/scsi/isci/init.c 2013-02-07 09:59:49.000000000 -0500
-++++ b/drivers/scsi/isci/init.c 2013-02-07 10:01:51.000000000 -0500
-+@@ -119,6 +119,10 @@
-+ module_param(phy_gen, byte, 0);
-+ MODULE_PARM_DESC(phy_gen, "PHY generation (1: 1.5Gbps 2: 3.0Gbps 3: 6.0Gbps)");
-+
-++u16 sg_table_size = SG_ALL;
-++module_param(sg_table_size, ushort, 0);
-++MODULE_PARM_DESC(sg_table_size, "Size in KB of scatter gather table");
-++
-+ unsigned char max_concurr_spinup;
-+ module_param(max_concurr_spinup, byte, 0);
-+ MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
-+@@ -163,7 +167,6 @@
-+ .can_queue = ISCI_CAN_QUEUE_VAL,
-+ .cmd_per_lun = 1,
-+ .this_id = -1,
-+- .sg_tablesize = SG_ALL,
-+ .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
-+ .use_clustering = ENABLE_CLUSTERING,
-+ .eh_abort_handler = sas_eh_abort_handler,
-+@@ -573,6 +576,7 @@
-+
-+ INIT_LIST_HEAD(&idev->node);
-+ }
-++ isci_sht.sg_tablesize = sg_table_size;
-+
-+ shost = scsi_host_alloc(&isci_sht, sizeof(void *));
-+ if (!shost)
-+Increase MAX_SGE for fusion mpt driver.
-+
-+Index: linux-2.6.32.i386/drivers/message/fusion/Kconfig
-+===================================================================
-+--- linux-2.6.32.i386.orig/drivers/message/fusion/Kconfig 2009-12-03 09:21:21.000000000 +0530
-++++ linux-2.6.32.i386/drivers/message/fusion/Kconfig 2010-03-16 16:45:08.000000000 +0530
-+@@ -61,9 +61,9 @@
-+ LSISAS1078
-+
-+ config FUSION_MAX_SGE
-+- int "Maximum number of scatter gather entries (16 - 128)"
-+- default "128"
-+- range 16 128
-++ int "Maximum number of scatter gather entries (16 - 256)"
-++ default "256"
-++ range 16 256
-+ help
-+ This option allows you to specify the maximum number of scatter-
-+ gather entries per I/O. The driver default is 128, which matches
-+Index: linux-2.6.32.i386/drivers/message/fusion/mptbase.h
-+===================================================================
-+--- linux-2.6.32.i386.orig/drivers/message/fusion/mptbase.h 2009-12-03 09:21:21.000000000 +0530
-++++ linux-2.6.32.i386/drivers/message/fusion/mptbase.h 2010-03-16 16:46:54.000000000 +0530
-+@@ -165,10 +165,10 @@
-+ * Set the MAX_SGE value based on user input.
-+ */
-+ #ifdef CONFIG_FUSION_MAX_SGE
-+-#if CONFIG_FUSION_MAX_SGE < 16
-++#if CONFIG_FUSION_MAX_SGE < 16
-+ #define MPT_SCSI_SG_DEPTH 16
-+-#elif CONFIG_FUSION_MAX_SGE > 128
-+-#define MPT_SCSI_SG_DEPTH 128
-++#elif CONFIG_FUSION_MAX_SGE > 256
-++#define MPT_SCSI_SG_DEPTH 256
-+ #else
-+ #define MPT_SCSI_SG_DEPTH CONFIG_FUSION_MAX_SGE
-+ #endif
-diff --git a/lustre/kernel_patches/patches/dev_read_only-3.7.patch b/lustre/kernel_patches/patches/dev_read_only-3.7.patch
-new file mode 100644
-index 0000000..7fb0b98
---- /dev/null
-+++ b/lustre/kernel_patches/patches/dev_read_only-3.7.patch
-@@ -0,0 +1,174 @@
-+This patch is no longer needed for Lustre. It is only included
-+for testing and ease of using the same kernel with older Lustre
-+versions. This testing functionality was replaced in Linux 3.0
-+by the dm-flakey driver.
-+
-+This functionality is mainly used during testing, in order to
-+simulate a server crash for ldiskfs by discarding all of the
-+writes to the filesystem. For recovery testing we could simulate
-+this by using a special loopback or DM device that also discards
-+writes to the device.
-+
-+This functionality is also used by target "failback" in order
-+to speed up service shutdown and takeover by the other node
-+during controlled operation. However, it would also be possible
-+to do this by simply allowing all of the in-flight requests to
-+complete and then waiting for the service to stop. This will
-+also be needed by the DMU-OSD, because discarding of writes on
-+a DMU-based target is not safe as it could trigger a storage
-+failure if the data is ever read from disk again and the
-+checksum does not match that expected by the block pointer.
-+
-+Index: linux-3.6.0-0.3.fc.el6.x86_64/block/blk-core.c
-+===================================================================
-+--- linux-3.6.0-0.3.fc.el6.x86_64.orig/block/blk-core.c 2012-09-30 19:47:46.000000000 -0400
-++++ linux-3.6.0-0.3.fc.el6.x86_64/block/blk-core.c 2012-11-16 11:35:04.419174277 -0500
-+@@ -1606,6 +1606,8 @@ static inline bool should_fail_request(s
-+
-+ #endif /* CONFIG_FAIL_MAKE_REQUEST */
-+
-++int dev_check_rdonly(struct block_device *bdev);
-++
-+ /*
-+ * Check whether this bio extends beyond the end of the device.
-+ */
-+@@ -1668,6 +1670,12 @@ generic_make_request_checks(struct bio *
-+ goto end_io;
-+ }
-+
-++ /* this is cfs's dev_rdonly check */
-++ if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
-++ err = 0;
-++ goto end_io;
-++ }
-++
-+ part = bio->bi_bdev->bd_part;
-+ if (should_fail_request(part, bio->bi_size) ||
-+ should_fail_request(&part_to_disk(part)->part0,
-+@@ -3034,6 +3042,99 @@ void blk_finish_plug(struct blk_plug *pl
-+ }
-+ EXPORT_SYMBOL(blk_finish_plug);
-+
-++/*
-++ * Debug code for turning block devices "read-only" (will discard writes
-++ * silently). This is for filesystem crash/recovery testing.
-++ */
-++struct deventry {
-++ dev_t dev;
-++ struct deventry *next;
-++};
-++
-++static struct deventry *devlist = NULL;
-++static spinlock_t devlock = __SPIN_LOCK_UNLOCKED(devlock);
-++
-++int dev_check_rdonly(struct block_device *bdev)
-++{
-++ struct deventry *cur;
-++
-++ if (!bdev)
-++ return 0;
-++
-++ spin_lock(&devlock);
-++ cur = devlist;
-++ while(cur) {
-++ if (bdev->bd_dev == cur->dev) {
-++ spin_unlock(&devlock);
-++ return 1;
-++ }
-++ cur = cur->next;
-++ }
-++ spin_unlock(&devlock);
-++ return 0;
-++}
-++
-++void dev_set_rdonly(struct block_device *bdev)
-++{
-++ struct deventry *newdev, *cur;
-++
-++ if (!bdev)
-++ return;
-++
-++ newdev = kmalloc(sizeof(struct deventry), GFP_KERNEL);
-++ if (!newdev)
-++ return;
-++
-++ spin_lock(&devlock);
-++ cur = devlist;
-++ while(cur) {
-++ if (bdev->bd_dev == cur->dev) {
-++ spin_unlock(&devlock);
-++ kfree(newdev);
-++ return;
-++ }
-++ cur = cur->next;
-++ }
-++ newdev->dev = bdev->bd_dev;
-++ newdev->next = devlist;
-++ devlist = newdev;
-++ spin_unlock(&devlock);
-++ printk(KERN_WARNING "Turning device %s (%#x) read-only\n",
-++ bdev->bd_disk ? bdev->bd_disk->disk_name : "", bdev->bd_dev);
-++}
-++
-++void dev_clear_rdonly(struct block_device *bdev)
-++{
-++ struct deventry *cur, *last = NULL;
-++
-++ if (!bdev)
-++ return;
-++
-++ spin_lock(&devlock);
-++ cur = devlist;
-++ while(cur) {
-++ if (bdev->bd_dev == cur->dev) {
-++ if (last)
-++ last->next = cur->next;
-++ else
-++ devlist = cur->next;
-++ spin_unlock(&devlock);
-++ kfree(cur);
-++ printk(KERN_WARNING "Removing read-only on %s (%#x)\n",
-++ bdev->bd_disk ? bdev->bd_disk->disk_name :
-++ "unknown block", bdev->bd_dev);
-++ return;
-++ }
-++ last = cur;
-++ cur = cur->next;
-++ }
-++ spin_unlock(&devlock);
-++}
-++
-++EXPORT_SYMBOL(dev_set_rdonly);
-++EXPORT_SYMBOL(dev_clear_rdonly);
-++EXPORT_SYMBOL(dev_check_rdonly);
-++
-+ int __init blk_dev_init(void)
-+ {
-+ BUILD_BUG_ON(__REQ_NR_BITS > 8 *
-+Index: linux-3.6.0-0.3.fc.el6.x86_64/fs/block_dev.c
-+===================================================================
-+--- linux-3.6.0-0.3.fc.el6.x86_64.orig/fs/block_dev.c 2011-05-10 21:38:29.000000000 +0300
-++++ linux-3.6.0-0.3.fc.el6.x86_64/fs/block_dev.c 2011-05-19 21:01:04.000000000 +0300
-+@@ -1389,6 +1389,7 @@ static int __blkdev_put(struct block_dev
-+ if (bdev != bdev->bd_contains)
-+ victim = bdev->bd_contains;
-+ bdev->bd_contains = NULL;
-++ dev_clear_rdonly(bdev);
-+
-+ put_disk(disk);
-+ module_put(owner);
-+Index: linux-3.6.0-0.3.fc.el6.x86_64/include/linux/fs.h
-+===================================================================
-+--- linux-3.6.0-0.3.fc.el6.x86_64.orig/include/linux/fs.h 2011-05-10 21:38:29.000000000 +0300
-++++ linux-3.6.0-0.3.fc.el6.x86_64/include/linux/fs.h 2011-05-19 21:01:04.000000000 +0300
-+@@ -2244,6 +2244,10 @@ struct bio;
-+ extern void submit_bio(int, struct bio *);
-+ extern int bdev_read_only(struct block_device *);
-+ #endif
-++#define HAVE_CLEAR_RDONLY_ON_PUT
-++extern void dev_set_rdonly(struct block_device *bdev);
-++extern int dev_check_rdonly(struct block_device *bdev);
-++extern void dev_clear_rdonly(struct block_device *bdev);
-+ extern int set_blocksize(struct block_device *, int);
-+ extern int sb_set_blocksize(struct super_block *, int);
-+ extern int sb_min_blocksize(struct super_block *, int);
-diff --git a/lustre/kernel_patches/patches/raid5-mmp-unplug-dev-3.7.patch b/lustre/kernel_patches/patches/raid5-mmp-unplug-dev-3.7.patch
-new file mode 100644
-index 0000000..70b9992
---- /dev/null
-+++ b/lustre/kernel_patches/patches/raid5-mmp-unplug-dev-3.7.patch
-@@ -0,0 +1,21 @@
-+--- linux-3.6.0-0.3.fc.el6.x86_64/drivers/md/raid5.c.orig 2012-11-21 08:51:15.312175089 -0500
-++++ linux-3.6.0-0.3.fc.el6.x86_64/drivers/md/raid5.c 2012-11-21 09:02:38.415174560 -0500
-+@@ -2394,6 +2394,8 @@ static int add_stripe_bio(struct stripe_
-+ bi->bi_next = *bip;
-+ *bip = bi;
-+ raid5_inc_bi_active_stripes(bi);
-++ if ((bi->bi_rw & REQ_SYNC) && !forwrite)
-++ clear_bit(R5_UPTODATE, &sh->dev[dd_idx].flags); /* force to read from disk. */
-+
-+ if (forwrite) {
-+ /* check if page is covered */
-+@@ -4217,6 +4222,9 @@ static void make_request(struct mddev *m
-+
-+ bio_endio(bi, 0);
-+ }
-++
-++ if (bi->bi_rw & REQ_SYNC)
-++ md_wakeup_thread(mddev->thread);
-+ }
-+
-+ static sector_t raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks);
-diff --git a/lustre/kernel_patches/series/3.x-fc18.series b/lustre/kernel_patches/series/3.x-fc18.series
-new file mode 100644
-index 0000000..387a2dd
---- /dev/null
-+++ b/lustre/kernel_patches/series/3.x-fc18.series
-@@ -0,0 +1,4 @@
-+raid5-mmp-unplug-dev-3.7.patch
-+dev_read_only-3.7.patch
-+blkdev_tunables-3.7.patch
-+bh_lru_size_config.patch
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0009-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch b/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
similarity index 91%
rename from sys-cluster/lustre/files/0009-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
rename to sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
index dbfda90..a5af8be 100644
--- a/sys-cluster/lustre/files/0009-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
+++ b/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
@@ -1,7 +1,7 @@
-From a48ffc03f6d9630e66720089ed01c9f4f1ec10fc Mon Sep 17 00:00:00 2001
+From e4b7000ba2dde158a990130bcaee91256255c280 Mon Sep 17 00:00:00 2001
From: Alexey Shvetsov <alexxy@gentoo.org>
Date: Mon, 18 Mar 2013 16:22:27 +0400
-Subject: [PATCH 09/12] LU-2982 build: make AC check for linux arch sandbox
+Subject: [PATCH 1/4] LU-2982 build: make AC check for linux arch sandbox
friendly
this commit makes AC check for linux kernel arch sandbox friendly
@@ -14,10 +14,10 @@ Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
1 file changed, 58 insertions(+), 8 deletions(-)
diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4
-index a78bfe3..d8451e0 100644
+index 95d20e2..de9df76 100644
--- a/config/lustre-build-linux.m4
+++ b/config/lustre-build-linux.m4
-@@ -362,14 +362,64 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
+@@ -365,14 +365,64 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
# Determine the kernel's idea of the current architecture
#
AC_DEFUN([LB_LINUX_ARCH],
diff --git a/sys-cluster/lustre/files/0003-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch b/sys-cluster/lustre/files/0002-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch
similarity index 70%
rename from sys-cluster/lustre/files/0003-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch
rename to sys-cluster/lustre/files/0002-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch
index 95ef999..8e02095 100644
--- a/sys-cluster/lustre/files/0003-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch
+++ b/sys-cluster/lustre/files/0002-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch
@@ -1,22 +1,22 @@
-From 025fda5f3a44942e7c87f180fc7275529e5405fa Mon Sep 17 00:00:00 2001
+From 1359b3ff29d39aae651457e39942b5ff61092d6c Mon Sep 17 00:00:00 2001
From: yangsheng <yang.sheng@intel.com>
-Date: Mon, 8 Apr 2013 21:04:22 +0800
-Subject: [PATCH 03/12] LU-2686 kernel: Kernel update for 3.7.2-201.fc18
+Date: Wed, 10 Jul 2013 13:52:41 +0800
+Subject: [PATCH 2/4] LU-2686 kernel: Kernel update for 3.7.2-201.fc18
-Add uapi header to include search path.
+Add uapi header to include search path
Signed-off-by: yang sheng <yang.sheng@intel.com>
+Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Id90e091fef63ebf5bb8e7765969aa3148cc31aa2
---
autoMakefile.am | 2 +-
- config/lustre-build-linux.m4 | 21 +++++++++++++--------
- ldiskfs/config/ldiskfs-build.m4 | 22 ++++++++++++++--------
- lustre/autoconf/lustre-core.m4 | 1 +
+ config/lustre-build-linux.m4 | 19 ++++++++++++-------
+ ldiskfs/config/ldiskfs-build.m4 | 20 +++++++++++++-------
lustre/scripts/version_tag.pl | 4 +++-
- 5 files changed, 32 insertions(+), 18 deletions(-)
+ 4 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/autoMakefile.am b/autoMakefile.am
-index 1cc3b48..7b8a096 100644
+index 9b6dcfd..71d8db4 100644
--- a/autoMakefile.am
+++ b/autoMakefile.am
@@ -84,7 +84,7 @@ all-am: modules
@@ -24,12 +24,12 @@ index 1cc3b48..7b8a096 100644
$(MAKE) CC="$(CC)" $(CROSS_VARS) -C $(LINUX_OBJ) \
-f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
- LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
-+ LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -I$$(srctree)/arch/$$(SRCARCH)/include/uapi -Iarch/$$(SRCARCH)/include/generated/uapi -I$$(srctree)/include/uapi -Iinclude/generated/uapi -include $(CONFIG_INCLUDE)' \
++ LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -I$$(srctree)/arch/$$(SRCARCH)/include/uapi -Iarch/$$(SRCARCH)/include/generated/uapi -I$$(srctree)/include/uapi -Iinclude/generated/uapi -include $(CONFIG_INCLUDE)' \
$(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
include/config/MARKER $@
endif # LINUX
diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4
-index b08ae65..a78bfe3 100644
+index de9df76..8849f14 100644
--- a/config/lustre-build-linux.m4
+++ b/config/lustre-build-linux.m4
@@ -44,7 +44,7 @@ AC_MSG_CHECKING([for Linux release])
@@ -59,23 +59,21 @@ index b08ae65..a78bfe3 100644
],[
#ifndef RHEL_RELEASE_CODE
#error "not redhat kernel"
-@@ -222,9 +222,13 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
+@@ -222,8 +222,12 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
[LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
[AC_MSG_ERROR([Run make config in $LINUX.])])])
AC_SUBST(AUTOCONF_HDIR)
-LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[],
- [AC_MSG_ERROR([Run make config in $LINUX.])])
--
+LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h], [VERSION_HDIR=linux],
+ [LB_CHECK_FILE([$LINUX_OBJ/include/generated/uapi/linux/version.h],
+ [VERSION_HDIR=generated/uapi/linux],
+ [AC_MSG_ERROR([Run make config in $LINUX.])])
+ ])
-+ AC_SUBST(VERSION_HDIR)
-+
++ AC_SUBST(VERSION_HDIR)
+
# ----------- kconfig.h exists ---------------
# kernel 3.1, $LINUX/include/linux/kconfig.h is added
- # see kernel commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
@@ -240,7 +244,7 @@ LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
# tarred up the tree and ran make dep etc. in it, then
# version.h gets overwritten with a standard linux one.
@@ -85,7 +83,7 @@ index b08ae65..a78bfe3 100644
# This is a clean kernel-source tree, we need to
# enable extensive workarounds to get this to build
# modules
-@@ -344,7 +348,8 @@ $2
+@@ -352,7 +356,8 @@ $2
AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
@@ -96,36 +94,35 @@ index b08ae65..a78bfe3 100644
[_AC_MSG_LOG_CONFTEST
m4_ifvaln([$5],[$5])dnl])
diff --git a/ldiskfs/config/ldiskfs-build.m4 b/ldiskfs/config/ldiskfs-build.m4
-index be144de..a978bcf 100644
+index 38fce59..8a00872 100644
--- a/ldiskfs/config/ldiskfs-build.m4
+++ b/ldiskfs/config/ldiskfs-build.m4
-@@ -4,12 +4,12 @@ AC_DEFUN([LDISKFS_AC_LINUX_VERSION], [
- utsrelease1=${LINUX_OBJ}/include/linux/version.h
+@@ -1,9 +1,9 @@
+ AC_DEFUN([LDISKFS_AC_LINUX_VERSION], [
+ AC_MSG_CHECKING([kernel source version])
+
+- utsrelease1=${LINUX_OBJ}/include/linux/version.h
++ utsrelease1=${LINUX_OBJ}/include/generated/utsrelease.h
utsrelease2=${LINUX_OBJ}/include/linux/utsrelease.h
- utsrelease3=${LINUX_OBJ}/include/generated/utsrelease.h
-- AS_IF([test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [
-- utsrelease=linux/version.h
-+ AS_IF([test -r ${utsrelease3} && fgrep -q UTS_RELEASE ${utsrelease3}], [
-+ utsrelease=generated/utsrelease.h
+- utsrelease3=${LINUX_OBJ}/include/generated/utsrelease.h
++ utsrelease3=${LINUX_OBJ}/include/linux/version.h
+ AS_IF([test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [
+ utsrelease=${utsrelease1}
], [test -r ${utsrelease2} && fgrep -q UTS_RELEASE ${utsrelease2}], [
- utsrelease=linux/utsrelease.h
-- ], [test -r ${utsrelease3} && fgrep -q UTS_RELEASE ${utsrelease3}], [
-- utsrelease=generated/utsrelease.h
-+ ], [test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [
-+ utsrelease=linux/version.h
- ])
+@@ -60,10 +60,10 @@ AC_SUBST(RELEASE)
- AS_IF([test "${utsrelease}"], [
-@@ -64,7 +64,7 @@ AC_SUBST(RELEASE)
# check is redhat/suse kernels
- AC_MSG_CHECKING([that RedHat kernel])
- LB_LINUX_TRY_COMPILE([
-- #include <linux/version.h>
-+ #include <$VERSION_HDIR/version.h>
- ],[
- #ifndef RHEL_RELEASE_CODE
- #error "not redhat kernel"
-@@ -190,8 +190,14 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
+ AC_MSG_CHECKING([for RedHat kernel version])
+- AS_IF([fgrep -q RHEL_RELEASE ${LINUX_OBJ}/include/linux/version.h], [
++ AS_IF([fgrep -q RHEL_RELEASE ${LINUX_OBJ}/include/$VERSION_HDIR/version.h], [
+ RHEL_KERNEL="yes"
+ RHEL_RELEASE=$(expr 0$(awk -F \" '/ RHEL_RELEASE / { print [$]2 }' \
+- ${LINUX_OBJ}/include/linux/version.h) + 1)
++ ${LINUX_OBJ}/include/$VERSION_HDIR/version.h) + 1)
+ KERNEL_VERSION=$(sed -e 's/\(@<:@23@:>@\.@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/' <<< ${LINUXRELEASE})
+ RHEL_KERNEL_VERSION=${KERNEL_VERSION}-${RHEL_RELEASE}
+ AC_SUBST(RHEL_KERNEL_VERSION)
+@@ -184,8 +184,14 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
[LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
[AC_MSG_ERROR([Run make config in $LINUX.])])])
AC_SUBST(AUTOCONF_HDIR)
@@ -133,16 +130,16 @@ index be144de..a978bcf 100644
- [AC_MSG_ERROR([Run make config in $LINUX.])])
+LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h], [VERSION_HDIR=linux],
+ [LB_CHECK_FILE([$LINUX_OBJ/include/generated/uapi/linux/version.h],
-+ [VERSION_HDIR=generated/uapi/linux],
-+ [AC_MSG_ERROR([Run make config in $LINUX.])])
++ [VERSION_HDIR=generated/uapi/linux],
++ [AC_MSG_ERROR([Run make config in $LINUX.])])
+ ])
+ AC_SUBST(VERSION_HDIR)
-+
++
+
# ----------- kconfig.h exists ---------------
# kernel 3.1, $LINUX/include/linux/kconfig.h is added
-@@ -208,7 +214,7 @@ LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
+@@ -202,7 +208,7 @@ LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
# tarred up the tree and ran make dep etc. in it, then
# version.h gets overwritten with a standard linux one.
@@ -151,20 +148,8 @@ index be144de..a978bcf 100644
# This is a clean kernel-source tree, we need to
# enable extensive workarounds to get this to build
# modules
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index 7ac2b22..1972e17 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -328,6 +328,7 @@ AC_TRY_RUN([
- #define __LINUX_POSIX_ACL_H
-
- #ifdef CONFIG_FS_POSIX_ACL
-+ struct user_namespace;
- # include <linux/posix_acl_xattr.h>
- #endif
-
diff --git a/lustre/scripts/version_tag.pl b/lustre/scripts/version_tag.pl
-index 61796c9..07cbdf8 100644
+index 61796c9..4d2bb4a 100644
--- a/lustre/scripts/version_tag.pl
+++ b/lustre/scripts/version_tag.pl
@@ -43,8 +43,10 @@ sub get_kernver($$)
@@ -173,9 +158,9 @@ index 61796c9..07cbdf8 100644
my $ver = new IO::File;
- if (!$ver->open("$objdir/include/linux/utsrelease.h") &&
+ if (!$ver->open("$objdir/include/generated/utsrelease.h") &&
-+ !$ver->open("$objdir/include/linux/utsrelease.h") &&
++ !$ver->open("$objdir/include/linux/utsrelease.h") &&
!$ver->open("$objdir/include/linux/version.h") &&
-+ !$ver->open("$dir/include/generated/utsrelease.h") &&
++ !$ver->open("$dir/include/generated/utsrelease.h") &&
!$ver->open("$dir/include/linux/utsrelease.h") &&
!$ver->open("$dir/include/linux/version.h")) {
die "Run make dep on '$dir'\n";
diff --git a/sys-cluster/lustre/files/0002-LU-2686-kernel-sock_map_fd-replaced-by-sock_alloc_fi.patch b/sys-cluster/lustre/files/0002-LU-2686-kernel-sock_map_fd-replaced-by-sock_alloc_fi.patch
deleted file mode 100644
index 7d24cf8..0000000
--- a/sys-cluster/lustre/files/0002-LU-2686-kernel-sock_map_fd-replaced-by-sock_alloc_fi.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From c81da9c214f1b32aa9657df42288a9c25e63c434 Mon Sep 17 00:00:00 2001
-From: yangsheng <yang.sheng@intel.com>
-Date: Mon, 8 Apr 2013 21:14:09 +0800
-Subject: [PATCH 02/12] LU-2686 kernel: sock_map_fd() replaced by
- sock_alloc_file()
-
-Use sock_alloc_file() replace sock_map_fd().
-
-Signed-off-by: yang sheng <yang.sheng@intel.com>
-Change-Id: I04cbcd651689af6b82b48ba5d49ddbf99a6758bf
----
- libcfs/autoconf/lustre-libcfs.m4 | 27 ++++++++++++++++++++++++
- libcfs/libcfs/linux/linux-tcpip.c | 44 +++++++++++++++++++++++----------------
- 2 files changed, 53 insertions(+), 18 deletions(-)
-
-diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4
-index 312542d..4545a7a 100644
---- a/libcfs/autoconf/lustre-libcfs.m4
-+++ b/libcfs/autoconf/lustre-libcfs.m4
-@@ -793,6 +793,31 @@ LB_LINUX_TRY_COMPILE([
- ])
-
- #
-+# FC18 3.7.2-201 unexport sock_map_fd() change to
-+# use sock_alloc_file().
-+# upstream commit 56b31d1c9f1e6a3ad92e7bfe252721e05d92b285
-+#
-+AC_DEFUN([LIBCFS_SOCK_ALLOC_FILE],
-+[AC_MSG_CHECKING([sock_alloc_file is exported])
-+LB_CHECK_SYMBOL_EXPORT([sock_alloc_file], [net/socket.c],[
-+ LB_LINUX_TRY_COMPILE([
-+ #include <linux/net.h>
-+ ],[
-+ sock_alloc_file(NULL, 0, NULL);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SOCK_ALLOC_FILE_3ARGS, 1,
-+ [sock_alloc_file takes 3 arguments])
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SOCK_ALLOC_FILE, 1,
-+ [sock_alloc_file is exported])
-+ ])
-+],[
-+])
-+])
-+
-+#
- # LIBCFS_PROG_LINUX
- #
- # LNet linux kernel checks
-@@ -850,6 +875,8 @@ LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE
- LC_SK_SLEEP
- # 2.6.40 fc15
- LC_SHRINK_CONTROL
-+# 3.7
-+LIBCFS_SOCK_ALLOC_FILE
- ])
-
- #
-diff --git a/libcfs/libcfs/linux/linux-tcpip.c b/libcfs/libcfs/linux/linux-tcpip.c
-index 0a31b55..3be0f68 100644
---- a/libcfs/libcfs/linux/linux-tcpip.c
-+++ b/libcfs/libcfs/linux/linux-tcpip.c
-@@ -47,11 +47,11 @@
- int
- libcfs_sock_ioctl(int cmd, unsigned long arg)
- {
-- mm_segment_t oldmm = get_fs();
-- struct socket *sock;
-- int fd;
-- int rc;
-- struct file *sock_filp;
-+ mm_segment_t oldmm = get_fs();
-+ struct socket *sock;
-+ int fd = -1;
-+ int rc;
-+ struct file *sock_filp;
-
- rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
- if (rc != 0) {
-@@ -59,21 +59,27 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
- return rc;
- }
-
--#ifdef HAVE_SOCK_MAP_FD_2ARG
-- fd = sock_map_fd(sock,0);
-+#if !defined(HAVE_SOCK_ALLOC_FILE) && !defined(HAVE_SOCK_ALLOC_FILE_3ARGS)
-+# ifdef HAVE_SOCK_MAP_FD_2ARG
-+ fd = sock_map_fd(sock,0);
-+# else
-+ fd = sock_map_fd(sock);
-+# endif
-+ if (fd < 0) {
-+ rc = fd;
-+ goto out;
-+ }
-+ sock_filp = fget(fd);
- #else
-- fd = sock_map_fd(sock);
-+# ifdef HAVE_SOCK_ALLOC_FILE_3ARGS
-+ sock_filp = sock_alloc_file(sock, 0, NULL);
-+# else
-+ sock_filp = sock_alloc_file(sock, 0);
-+# endif
- #endif
-- if (fd < 0) {
-- rc = fd;
-- sock_release(sock);
-- goto out;
-- }
--
-- sock_filp = fget(fd);
- if (!sock_filp) {
- rc = -ENOMEM;
-- goto out_fd;
-+ goto out;
- }
-
- set_fs(KERNEL_DS);
-@@ -83,9 +89,11 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
-
- fput(sock_filp);
-
-- out_fd:
-- sys_close(fd);
- out:
-+ if (fd >= 0)
-+ sys_close(fd);
-+ else
-+ sock_release(sock);
- return rc;
- }
-
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0010-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch b/sys-cluster/lustre/files/0003-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch
similarity index 84%
rename from sys-cluster/lustre/files/0010-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch
rename to sys-cluster/lustre/files/0003-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch
index 510b6d3..0ed0061 100644
--- a/sys-cluster/lustre/files/0010-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch
+++ b/sys-cluster/lustre/files/0003-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch
@@ -1,7 +1,7 @@
-From b36528aa2738f3ee4c9b26694502212619ee7283 Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <alexxy@gentoo.org>
-Date: Sun, 31 Mar 2013 19:32:30 +0400
-Subject: [PATCH 10/12] LU-3079 kernel: 3.9 hlist_for_each_entry uses 3 args
+From 8eb9c28b3ac9bcc05f00259301c9bd92e8451a55 Mon Sep 17 00:00:00 2001
+From: James Simmons <uja.ornl@gmail.com>
+Date: Wed, 15 May 2013 09:18:19 -0400
+Subject: [PATCH 3/4] LU-3079 kernel: 3.9 hlist_for_each_entry uses 3 args
In 3.9 hlist_for_each_entry use 3 args since commit
@@ -12,12 +12,13 @@ Date: Wed Feb 27 17:06:00 2013 -0800
hlist: drop the node parameter from iterators
Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
+Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I8f38d562607de21771b03575e37cc0498867a570
---
libcfs/include/libcfs/list.h | 10 ++++++++++
- lustre/autoconf/lustre-core.m4 | 26 ++++++++++++++++++++++++++
+ lustre/autoconf/lustre-core.m4 | 27 +++++++++++++++++++++++++++
lustre/include/linux/lustre_compat25.h | 5 +++++
- 3 files changed, 41 insertions(+)
+ 3 files changed, 42 insertions(+)
diff --git a/libcfs/include/libcfs/list.h b/libcfs/include/libcfs/list.h
index be06e74..b747804 100644
@@ -49,11 +50,11 @@ index be06e74..b747804 100644
#define CFS_HLIST_HEAD_INIT HLIST_HEAD_INIT
#define CFS_HLIST_HEAD(n) HLIST_HEAD(n)
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index 909fe8a..e460935 100644
+index 9ac1194..2cb4edd 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
-@@ -2293,6 +2293,29 @@ LB_LINUX_TRY_COMPILE([
-
+@@ -1604,6 +1604,29 @@ LB_LINUX_TRY_COMPILE([
+ ])
#
+# 3.9 uses hlist_for_each_entry with 3 args
@@ -82,10 +83,11 @@ index 909fe8a..e460935 100644
# LC_PROG_LINUX
#
# Lustre linux kernel checks
-@@ -2481,6 +2504,9 @@ AC_DEFUN([LC_PROG_LINUX],
- # 3.8
- LC_HAVE_MM_VMTRUNCATE
+@@ -1740,6 +1763,10 @@ AC_DEFUN([LC_PROG_LINUX],
+ # 3.7
+ LC_HAVE_POSIXACL_USER_NS
++
+ # 3.9
+ LC_HAVE_HLIST_FOR_EACH_3ARG
+
@@ -93,10 +95,10 @@ index 909fe8a..e460935 100644
if test x$enable_server = xyes ; then
AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
-index 27139fb..da2b8c0 100644
+index 4e29e69..efb3fd1 100644
--- a/lustre/include/linux/lustre_compat25.h
+++ b/lustre/include/linux/lustre_compat25.h
-@@ -617,8 +617,13 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount)
+@@ -421,8 +421,13 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount)
#define ll_d_hlist_empty(list) hlist_empty(list)
#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry)
diff --git a/sys-cluster/lustre/files/0004-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch b/sys-cluster/lustre/files/0004-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch
deleted file mode 100644
index 04bac71..0000000
--- a/sys-cluster/lustre/files/0004-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From ceccbd0ba0715d45702d26f3a459435906b9dbf2 Mon Sep 17 00:00:00 2001
-From: Jeff Mahoney <jeffm@suse.com>
-Date: Wed, 20 Mar 2013 17:33:17 -0400
-Subject: [PATCH 04/12] LU-2850 compat: posix_acl_{to,from}_xattr take
- user_namespace
-
-Commit 5f3a4a28 (v3.7) added a struct user_namespace argument to
-posix_acl_{to,from}_xattr. Pretty much every caller just uses
-&init_user_ns. We mask it off in user mode so we don't need to
-create a fake structure only to ignore it.
-
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
-Change-Id: I558a06941b364f241fd4423720957beeaf1d3cea
----
- libcfs/include/libcfs/darwin/darwin-fs.h | 6 ++++--
- libcfs/include/libcfs/linux/linux-fs.h | 10 ++++++++++
- lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++
- lustre/include/liblustre.h | 4 ++++
- lustre/llite/xattr.c | 2 +-
- lustre/mdc/mdc_request.c | 3 ++-
- 6 files changed, 42 insertions(+), 4 deletions(-)
-
-diff --git a/libcfs/include/libcfs/darwin/darwin-fs.h b/libcfs/include/libcfs/darwin/darwin-fs.h
-index 998823b..9f71d6a 100644
---- a/libcfs/include/libcfs/darwin/darwin-fs.h
-+++ b/libcfs/include/libcfs/darwin/darwin-fs.h
-@@ -171,11 +171,13 @@ struct posix_acl {
- };
-
- struct posix_acl *posix_acl_alloc(int count, int flags);
--static inline struct posix_acl *posix_acl_from_xattr(const void *value,
-+static inline struct posix_acl *posix_acl_from_xattr(const void *value,
- size_t size)
--{
-+{
- return posix_acl_alloc(0, 0);
- }
-+#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c)
-+
- static inline void posix_acl_release(struct posix_acl *acl) {};
- static inline int posix_acl_valid(const struct posix_acl *acl) { return 0; }
- static inline struct posix_acl * posix_acl_dup(struct posix_acl *acl)
-diff --git a/libcfs/include/libcfs/linux/linux-fs.h b/libcfs/include/libcfs/linux/linux-fs.h
-index 53975ab..fa4e4d4 100644
---- a/libcfs/include/libcfs/linux/linux-fs.h
-+++ b/libcfs/include/libcfs/linux/linux-fs.h
-@@ -53,6 +53,7 @@
- #include <linux/stat.h>
- #include <linux/mount.h>
- #include <linux/backing-dev.h>
-+#include <linux/posix_acl_xattr.h>
-
- #define filp_size(f) \
- (i_size_read((f)->f_dentry->d_inode))
-@@ -102,4 +103,13 @@ ssize_t filp_user_write(struct file *filp, const void *buf, size_t count,
- #define DTTOIF(dirtype) ((dirtype) << IFSHIFT)
- #endif
-
-+#ifndef HAVE_POSIXACL_USER_NS
-+/*
-+ * Mask out &init_user_ns so we don't jump
-+ * through hoops to define it somehow only
-+ * to have it ignored anyway.
-+ */
-+#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c)
-+#define posix_acl_to_xattr(a,b,c,d) posix_acl_to_xattr(b,c,d)
-+#endif
- #endif
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index 1972e17..d0efbf4 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -2234,6 +2234,25 @@ LB_LINUX_TRY_COMPILE([
- ])
-
- #
-+# 3.7 posix_acl_{to,from}_xattr take struct user_namespace
-+#
-+AC_DEFUN([LC_HAVE_POSIXACL_USER_NS],
-+[AC_MSG_CHECKING([if posix_acl_to_xattr takes struct user_namespace])
-+LB_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ #include <linux/posix_acl_xattr.h>
-+],[
-+ posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
-+],[
-+ AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
-+ [posix_acl_to_xattr takes struct user_namespace])
-+ AC_MSG_RESULT([yes])
-+],[
-+ AC_MSG_RESULT([no])
-+])
-+])
-+
-+#
- # LC_PROG_LINUX
- #
- # Lustre linux kernel checks
-@@ -2415,6 +2434,8 @@ AC_DEFUN([LC_PROG_LINUX],
- LC_DENTRY_OPEN_USE_PATH
- LC_HAVE_IOP_ATOMIC_OPEN
-
-+ # 3.7
-+ LC_HAVE_POSIXACL_USER_NS
- #
- if test x$enable_server = xyes ; then
- AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
-diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h
-index b93d805..ad88587 100644
---- a/lustre/include/liblustre.h
-+++ b/lustre/include/liblustre.h
-@@ -458,6 +458,10 @@ struct posix_acl * posix_acl_from_xattr(const void *value, size_t size)
- return NULL;
- }
-
-+/* The kernel version takes 3 arguments, so strip that off first. */
-+#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c)
-+#define posix_acl_to_xattr(a,b,c) posix_acl_to_xattr(b,c)
-+
- static inline
- int posix_acl_valid(const struct posix_acl *acl)
- {
-diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c
-index 8772b74..a08c58a 100644
---- a/lustre/llite/xattr.c
-+++ b/lustre/llite/xattr.c
-@@ -345,7 +345,7 @@ int ll_getxattr_common(struct inode *inode, const char *name,
- if (!acl)
- RETURN(-ENODATA);
-
-- rc = posix_acl_to_xattr(acl, buffer, size);
-+ rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
- posix_acl_release(acl);
- RETURN(rc);
- }
-diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
-index 3ea8996..5751460 100644
---- a/lustre/mdc/mdc_request.c
-+++ b/lustre/mdc/mdc_request.c
-@@ -41,6 +41,7 @@
- # include <linux/pagemap.h>
- # include <linux/miscdevice.h>
- # include <linux/init.h>
-+# include <linux/utsname.h>
- #else
- # include <liblustre.h>
- #endif
-@@ -470,7 +471,7 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md)
- if (!buf)
- RETURN(-EPROTO);
-
-- acl = posix_acl_from_xattr(buf, body->aclsize);
-+ acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize);
- if (IS_ERR(acl)) {
- rc = PTR_ERR(acl);
- CERROR("convert xattr to acl: %d\n", rc);
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0011-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch b/sys-cluster/lustre/files/0004-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch
similarity index 82%
rename from sys-cluster/lustre/files/0011-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch
rename to sys-cluster/lustre/files/0004-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch
index bfcb3da..2dd2223 100644
--- a/sys-cluster/lustre/files/0011-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch
+++ b/sys-cluster/lustre/files/0004-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch
@@ -1,7 +1,7 @@
-From f8a2f09093e0279f32eb7e79b6d014bbee8482d7 Mon Sep 17 00:00:00 2001
+From 58a8bf674096caabc6edc0c598f16a0b04c05ebf Mon Sep 17 00:00:00 2001
From: Alexey Shvetsov <alexxy@gentoo.org>
Date: Sun, 31 Mar 2013 20:13:21 +0400
-Subject: [PATCH 11/12] LU-3079 kernel: f_vfsmnt replaced by f_path.mnt
+Subject: [PATCH 4/4] LU-3079 kernel: f_vfsmnt replaced by f_path.mnt
In linux 3.9 f_vfsmnt was killed and replaced
@@ -21,10 +21,10 @@ Change-Id: I02f595f0b7bbe804c9695d6da2106deb2d17e0ee
2 files changed, 27 insertions(+)
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index e460935..0cc6ef4 100644
+index 2cb4edd..ba69c41 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
-@@ -2316,6 +2316,28 @@ LB_LINUX_TRY_COMPILE([
+@@ -1627,6 +1627,28 @@ LB_LINUX_TRY_COMPILE([
])
#
@@ -53,7 +53,7 @@ index e460935..0cc6ef4 100644
# LC_PROG_LINUX
#
# Lustre linux kernel checks
-@@ -2506,6 +2528,7 @@ AC_DEFUN([LC_PROG_LINUX],
+@@ -1766,6 +1788,7 @@ AC_DEFUN([LC_PROG_LINUX],
# 3.9
LC_HAVE_HLIST_FOR_EACH_3ARG
@@ -62,10 +62,10 @@ index e460935..0cc6ef4 100644
#
if test x$enable_server = xyes ; then
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
-index 878f645..f7f7938 100644
+index dd7f7df..e625200 100644
--- a/lustre/llite/dir.c
+++ b/lustre/llite/dir.c
-@@ -640,7 +640,11 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
+@@ -629,7 +629,11 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
}
filp->f_version = inode->i_version;
#ifdef HAVE_TOUCH_ATIME_1ARG
diff --git a/sys-cluster/lustre/files/0005-LU-2800-llite-introduce-local-getname.patch b/sys-cluster/lustre/files/0005-LU-2800-llite-introduce-local-getname.patch
deleted file mode 100644
index 9dfae36..0000000
--- a/sys-cluster/lustre/files/0005-LU-2800-llite-introduce-local-getname.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 9248d7b04b67f683ac2a04b35793790047b50ab7 Mon Sep 17 00:00:00 2001
-From: Jeff Mahoney <jeffm@suse.com>
-Date: Tue, 19 Mar 2013 21:18:32 -0400
-Subject: [PATCH 05/12] LU-2800 llite: introduce local getname()
-
-Commit 8e377d15 (v3.7) unexported getname and putname. Although
-getname was re-exported, putname was not. All we really need is
-something to to allocate a buffer and copy it from userspace so
-let's just use our own version. The down size is that we lose
-the audit support in the original getname.
-
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
-Change-Id: If44cd9f9d14f26f220d5f0c52e8b804a49d3cf92
----
- lustre/llite/dir.c | 32 ++++++++++++++++++++++++++++----
- 1 file changed, 28 insertions(+), 4 deletions(-)
-
-diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
-index a3086d0..878f645 100644
---- a/lustre/llite/dir.c
-+++ b/lustre/llite/dir.c
-@@ -1228,6 +1228,30 @@ out:
- RETURN(rc);
- }
-
-+static char *
-+ll_getname(const char __user *filename)
-+{
-+ int ret = 0, len;
-+ char *tmp = __getname();
-+
-+ if (!tmp)
-+ return ERR_PTR(-ENOMEM);
-+
-+ len = strncpy_from_user(tmp, filename, PATH_MAX);
-+ if (len == 0)
-+ ret = -ENOENT;
-+ else if (len > PATH_MAX)
-+ ret = -ENAMETOOLONG;
-+
-+ if (ret) {
-+ __putname(tmp);
-+ tmp = ERR_PTR(ret);
-+ }
-+ return tmp;
-+}
-+
-+#define ll_putname(filename) __putname(filename)
-+
- static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
- {
- struct inode *inode = file->f_dentry->d_inode;
-@@ -1430,7 +1454,7 @@ free_lmv:
- if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE))
- return -ENOTSUPP;
-
-- filename = getname((const char *)arg);
-+ filename = ll_getname((const char *)arg);
- if (IS_ERR(filename))
- RETURN(PTR_ERR(filename));
-
-@@ -1441,7 +1465,7 @@ free_lmv:
- rc = ll_rmdir_entry(inode, filename, namelen);
- out_rmdir:
- if (filename)
-- putname(filename);
-+ ll_putname(filename);
- RETURN(rc);
- }
- case LL_IOC_LOV_SWAP_LAYOUTS:
-@@ -1461,7 +1485,7 @@ out_rmdir:
-
- if (cmd == IOC_MDC_GETFILEINFO ||
- cmd == IOC_MDC_GETFILESTRIPE) {
-- filename = getname((const char *)arg);
-+ filename = ll_getname((const char *)arg);
- if (IS_ERR(filename))
- RETURN(PTR_ERR(filename));
-
-@@ -1528,7 +1552,7 @@ out_rmdir:
- out_req:
- ptlrpc_req_finished(request);
- if (filename)
-- putname(filename);
-+ ll_putname(filename);
- return rc;
- }
- case IOC_LOV_GETINFO: {
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0006-LU-2987-llite-rcu-free-inode.patch b/sys-cluster/lustre/files/0006-LU-2987-llite-rcu-free-inode.patch
deleted file mode 100644
index f55f693..0000000
--- a/sys-cluster/lustre/files/0006-LU-2987-llite-rcu-free-inode.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From fe7ac0140ddb8fe5b8b046d857ed018ac9dc6335 Mon Sep 17 00:00:00 2001
-From: Peng Tao <tao.peng@emc.com>
-Date: Tue, 19 Mar 2013 14:04:47 +0800
-Subject: [PATCH 06/12] LU-2987 llite: rcu-free inode
-
-Since 2.6.38, inode.i_rcu was added and file system .destory_inode
-should rcu-free inodes.
-
-Signed-off-by: Peng Tao <tao.peng@emc.com>
-Change-Id: Idc12c94fd1bf9c99756c9bcb2d07f3061e6dad5a
----
- lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++
- lustre/llite/super25.c | 18 ++++++++++++++++--
- 2 files changed, 37 insertions(+), 2 deletions(-)
-
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index d0efbf4..bd7ef11 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -1683,6 +1683,26 @@ LB_LINUX_TRY_COMPILE([
- ])
-
- #
-+# 2.6.38 inode.i_rcu added.
-+#
-+AC_DEFUN([LC_INODE_I_RCU],
-+[AC_MSG_CHECKING([if inode.i_rcu exists])
-+LB_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+],[
-+ struct inode ino;
-+ struct rcu_head rcu = {};
-+ ino.i_rcu = rcu;
-+],[
-+ AC_DEFINE(HAVE_INODE_I_RCU, 1,
-+ [inode.i_rcu exists])
-+ AC_MSG_RESULT([yes])
-+],[
-+ AC_MSG_RESULT([no])
-+])
-+])
-+
-+#
- # 2.6.38 export blkdev_get_by_dev
- #
- AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
-@@ -2390,6 +2410,7 @@ AC_DEFUN([LC_PROG_LINUX],
- LC_GENERIC_PERMISSION
- LC_QUOTA_ON_USE_PATH
- LC_DCACHE_LOCK
-+ LC_INODE_I_RCU
- LC_D_COMPARE_7ARGS
- LC_D_DELETE_CONST
-
-diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c
-index 90949ff..0b9bdbc 100644
---- a/lustre/llite/super25.c
-+++ b/lustre/llite/super25.c
-@@ -61,11 +61,25 @@ static struct inode *ll_alloc_inode(struct super_block *sb)
- return &lli->lli_vfs_inode;
- }
-
-+#ifdef HAVE_INODE_I_RCU
-+static void ll_inode_destroy_callback(struct rcu_head *head)
-+{
-+ struct inode *inode = container_of(head, struct inode, i_rcu);
-+ struct ll_inode_info *ptr = ll_i2info(inode);
-+ OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
-+}
-+
-+static void ll_destroy_inode(struct inode *inode)
-+{
-+ call_rcu(&inode->i_rcu, ll_inode_destroy_callback);
-+}
-+#else
- static void ll_destroy_inode(struct inode *inode)
- {
-- struct ll_inode_info *ptr = ll_i2info(inode);
-- OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
-+ struct ll_inode_info *ptr = ll_i2info(inode);
-+ OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
- }
-+#endif
-
- int ll_init_inodecache(void)
- {
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0007-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch b/sys-cluster/lustre/files/0007-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch
deleted file mode 100644
index 4ce5b1f..0000000
--- a/sys-cluster/lustre/files/0007-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 019311dd1ae9e97336748f016afd2581d8ecc213 Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <alexxy@gentoo.org>
-Date: Wed, 17 Apr 2013 13:27:55 +0400
-Subject: [PATCH 07/12] LU-2850 kernel: 3.8 upstream removes vmtruncate()
-
-vmtruncate() is removed since upstream commit b9f61c3.
-We can open code is for llite though.
-
-Signed-off-by: Peng Tao <tao.peng@emc.com>
-Change-Id: I9d4f43a5c181f16482b4caa021ba7a09ee52b600
----
- lustre/autoconf/lustre-core.m4 | 24 ++++++++++++++++++++++++
- lustre/llite/vvp_io.c | 10 +++++++++-
- 2 files changed, 33 insertions(+), 1 deletion(-)
-
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index bd7ef11..909fe8a 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -2273,6 +2273,26 @@ LB_LINUX_TRY_COMPILE([
- ])
-
- #
-+# 3.8 removes vmtruncate()
-+# see upstream commit b9f61c3
-+#
-+AC_DEFUN([LC_HAVE_MM_VMTRUNCATE],
-+[AC_MSG_CHECKING([if mm has vmtruncate])
-+LB_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+],[
-+ vmtruncate(NULL, 0);
-+],[
-+ AC_DEFINE(HAVE_MM_VMTRUNCATE, 1,
-+ [vmtruncate is defined by the kernel])
-+ AC_MSG_RESULT([yes])
-+],[
-+ AC_MSG_RESULT([no])
-+])
-+])
-+
-+
-+#
- # LC_PROG_LINUX
- #
- # Lustre linux kernel checks
-@@ -2457,6 +2477,10 @@ AC_DEFUN([LC_PROG_LINUX],
-
- # 3.7
- LC_HAVE_POSIXACL_USER_NS
-+
-+ # 3.8
-+ LC_HAVE_MM_VMTRUNCATE
-+
- #
- if test x$enable_server = xyes ; then
- AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
-diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c
-index 3a64517..59a3bd8 100644
---- a/lustre/llite/vvp_io.c
-+++ b/lustre/llite/vvp_io.c
-@@ -362,9 +362,17 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size)
- * Only ll_inode_size_lock is taken at this level.
- */
- ll_inode_size_lock(inode);
-+#ifdef HAVE_MM_VMTRUNCATE
- result = vmtruncate(inode, size);
-+#else
-+ result = inode_newsize_ok(inode, size);
-+ if (result < 0) {
-+ ll_inode_size_unlock(inode);
-+ return result;
-+ }
-+ truncate_setsize(inode, size);
-+#endif
- ll_inode_size_unlock(inode);
--
- return result;
- }
-
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0008-LU-2850-kernel-3.8-upstream-kills-daemonize.patch b/sys-cluster/lustre/files/0008-LU-2850-kernel-3.8-upstream-kills-daemonize.patch
deleted file mode 100644
index 3094ef4..0000000
--- a/sys-cluster/lustre/files/0008-LU-2850-kernel-3.8-upstream-kills-daemonize.patch
+++ /dev/null
@@ -1,3005 +0,0 @@
-From 3440a08d1e950bddff32304ea1ba919d63ae47be Mon Sep 17 00:00:00 2001
-From: Peng Tao <tao.peng@emc.com>
-Date: Tue, 23 Apr 2013 10:18:04 -0400
-Subject: [PATCH 08/12] LU-2850 kernel: 3.8 upstream kills daemonize()
-
-kernel_thread() is a low level kernel function.
-Instead of calling kernel_thread() and relying on daemonize()
-to create new kernel threads, we should really switch to
-kthread_run() and elimilate daemonize().
-
-Conflicts:
- lustre/mdd/mdd_lfsck.c
-
-Signed-off-by: Peng Tao <tao.peng@emc.com>
-Signed-off-by: James Simmons <uja.ornl@gmail.com>
-Change-Id: I9f977bfc5d58192957d8c8d634204f4910edfa2a
----
- libcfs/autoconf/lustre-libcfs.m4 | 28 -----------
- libcfs/include/libcfs/darwin/darwin-prim.h | 6 +--
- libcfs/include/libcfs/libcfs.h | 13 +----
- libcfs/include/libcfs/linux/linux-prim.h | 9 ----
- libcfs/include/libcfs/posix/libcfs.h | 1 +
- libcfs/include/libcfs/user-prim.h | 5 +-
- libcfs/include/libcfs/winnt/winnt-prim.h | 4 --
- libcfs/libcfs/Makefile.in | 4 +-
- libcfs/libcfs/darwin/darwin-prim.c | 39 +++++++-------
- libcfs/libcfs/darwin/darwin-utils.c | 2 +-
- libcfs/libcfs/debug.c | 20 ++++----
- libcfs/libcfs/linux/Makefile.am | 2 +-
- libcfs/libcfs/linux/linux-lwt.c | 81 ------------------------------
- libcfs/libcfs/linux/linux-prim.c | 40 +++++----------
- libcfs/libcfs/tracefile.c | 15 +++---
- libcfs/libcfs/user-prim.c | 38 +++++++-------
- libcfs/libcfs/watchdog.c | 25 ++++-----
- libcfs/libcfs/winnt/winnt-prim.c | 27 ++++------
- libcfs/libcfs/winnt/winnt-tcpip.c | 8 +--
- libcfs/libcfs/workitem.c | 26 +++++-----
- lnet/klnds/gnilnd/gnilnd_cb.c | 4 --
- lnet/klnds/gnilnd/gnilnd_conn.c | 6 ---
- lnet/klnds/gnilnd/gnilnd_stack.c | 2 -
- lnet/klnds/mxlnd/mxlnd.c | 34 ++++++++-----
- lnet/klnds/mxlnd/mxlnd_cb.c | 11 ----
- lnet/klnds/o2iblnd/o2iblnd.c | 13 +++--
- lnet/klnds/o2iblnd/o2iblnd.h | 2 +-
- lnet/klnds/o2iblnd/o2iblnd_cb.c | 23 +++------
- lnet/klnds/ptllnd/ptllnd.c | 5 +-
- lnet/klnds/ptllnd/ptllnd_cb.c | 25 ++++-----
- lnet/klnds/qswlnd/qswlnd.c | 3 +-
- lnet/klnds/qswlnd/qswlnd_cb.c | 13 +++--
- lnet/klnds/ralnd/ralnd.c | 10 ++--
- lnet/klnds/ralnd/ralnd.h | 2 +-
- lnet/klnds/ralnd/ralnd_cb.c | 19 ++-----
- lnet/klnds/socklnd/socklnd.c | 19 +++++--
- lnet/klnds/socklnd/socklnd.h | 2 +-
- lnet/klnds/socklnd/socklnd_cb.c | 30 ++++-------
- lnet/lnet/acceptor.c | 11 ++--
- lnet/lnet/module.c | 10 ++--
- lnet/lnet/router.c | 20 ++++----
- lnet/selftest/timer.c | 11 ++--
- lnet/ulnds/socklnd/usocklnd.c | 17 ++++---
- lustre/ldlm/ldlm_lib.c | 31 +++++-------
- lustre/ldlm/ldlm_lockd.c | 41 +++++++--------
- lustre/ldlm/ldlm_pool.c | 53 +++++++++----------
- lustre/llite/llite_capa.c | 25 +++++----
- lustre/llite/llite_close.c | 26 ++++------
- lustre/llite/lloop.c | 10 ++--
- lustre/llite/statahead.c | 61 +++++++++++-----------
- lustre/mdc/mdc_request.c | 34 ++++++-------
- lustre/mdd/mdd_lfsck.c | 7 ++-
- lustre/mdt/mdt_capa.c | 26 +++++-----
- lustre/mgc/mgc_request.c | 31 ++++++------
- lustre/mgs/mgs_nids.c | 13 ++---
- lustre/obdclass/genops.c | 22 +++-----
- lustre/obdclass/llog.c | 8 +--
- lustre/osd-ldiskfs/osd_scrub.c | 5 +-
- lustre/osp/osp_precreate.c | 15 +++---
- lustre/osp/osp_sync.c | 9 ++--
- lustre/ptlrpc/import.c | 34 +++++++------
- lustre/ptlrpc/pinger.c | 39 +++++++-------
- lustre/ptlrpc/ptlrpcd.c | 25 +++++----
- lustre/ptlrpc/sec_gc.c | 12 ++---
- lustre/ptlrpc/service.c | 25 +++++----
- lustre/quota/qmt_lock.c | 17 +++----
- lustre/quota/qsd_reint.c | 6 +--
- lustre/quota/qsd_writeback.c | 16 +++---
- 68 files changed, 516 insertions(+), 760 deletions(-)
- delete mode 100644 libcfs/libcfs/linux/linux-lwt.c
-
-diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4
-index 4545a7a..0f53b9a 100644
---- a/libcfs/autoconf/lustre-libcfs.m4
-+++ b/libcfs/autoconf/lustre-libcfs.m4
-@@ -638,15 +638,6 @@ LB_LINUX_TRY_COMPILE([
- ])
- ])
-
--AC_DEFUN([LIBCFS_HAVE_OOM_H],
--[LB_CHECK_FILE([$LINUX/include/linux/oom.h], [
-- AC_DEFINE(HAVE_LINUX_OOM_H, 1,
-- [kernel has include/oom.h])
--],[
-- AC_MSG_RESULT([no])
--])
--])
--
- AC_DEFUN([LIBCFS_HAVE_KEYTYPE_H],
- [LB_CHECK_FILE([$LINUX/include/linux/key-type.h], [
- AC_DEFINE(HAVE_LINUX_KEYTYPE_H, 1,
-@@ -696,23 +687,6 @@ LB_LINUX_TRY_COMPILE([
- ])
- ])
-
--# 2.6.18 store oom parameters in task struct.
--# 2.6.32 store oom parameters in signal struct
--AC_DEFUN([LIBCFS_OOMADJ_IN_SIG],
--[AC_MSG_CHECKING([kernel store oom parameters in task])
--LB_LINUX_TRY_COMPILE([
-- #include <linux/sched.h>
--],[
-- ((struct signal_struct *)0)->oom_adj = 0;
--],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_OOMADJ_IN_SIG, 1,
-- [kernel store a oom parameters in signal struct])
--],[
-- AC_MSG_RESULT(no)
--])
--])
--
- #
- # 2.6.33 no longer has ctl_name & strategy field in struct ctl_table.
- #
-@@ -865,8 +839,6 @@ LIBCFS_HAVE_SET_MEMS_ALLOWED
- # 2.6.32
- LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
- LC_SHRINKER_WANT_SHRINK_PTR
--LIBCFS_HAVE_OOM_H
--LIBCFS_OOMADJ_IN_SIG
- # 2.6.33
- LIBCFS_SYSCTL_CTLNAME
- # 2.6.34
-diff --git a/libcfs/include/libcfs/darwin/darwin-prim.h b/libcfs/include/libcfs/darwin/darwin-prim.h
-index 7bc7af3..583e257 100644
---- a/libcfs/include/libcfs/darwin/darwin-prim.h
-+++ b/libcfs/include/libcfs/darwin/darwin-prim.h
-@@ -202,10 +202,8 @@ extern task_t kernel_task;
-
- #define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
-
--#define CFS_DAEMON_FLAGS (CLONE_VM | CLONE_FILES)
--
--extern int cfs_create_thread(cfs_thread_t func, void *arg, unsigned long flag);
--
-+extern cfs_task_t kthread_run(cfs_thread_t func, void *arg,
-+ const char namefmt[], ...);
-
- /*
- * Wait Queue implementation
-diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h
-index 2375ed9..34c36a3 100644
---- a/libcfs/include/libcfs/libcfs.h
-+++ b/libcfs/include/libcfs/libcfs.h
-@@ -226,8 +226,7 @@ void cfs_enter_debugger(void);
- /*
- * Defined by platform
- */
--void cfs_daemonize(char *str);
--int cfs_daemonize_ctxt(char *str);
-+int unshare_fs_struct(void);
- cfs_sigset_t cfs_get_blocked_sigs(void);
- cfs_sigset_t cfs_block_allsigs(void);
- cfs_sigset_t cfs_block_sigs(unsigned long sigs);
-@@ -236,16 +235,6 @@ void cfs_restore_sigs(cfs_sigset_t);
- int cfs_signal_pending(void);
- void cfs_clear_sigpending(void);
-
--/*
-- * XXX Liang:
-- * these macros should be removed in the future,
-- * we keep them just for keeping libcfs compatible
-- * with other branches.
-- */
--#define libcfs_daemonize(s) cfs_daemonize(s)
--#define cfs_sigmask_lock(f) do { f= 0; } while (0)
--#define cfs_sigmask_unlock(f) do { f= 0; } while (0)
--
- int convert_server_error(__u64 ecode);
- int convert_client_oflag(int cflag, int *result);
-
-diff --git a/libcfs/include/libcfs/linux/linux-prim.h b/libcfs/include/libcfs/linux/linux-prim.h
-index 1aeb5aa..31298e1 100644
---- a/libcfs/include/libcfs/linux/linux-prim.h
-+++ b/libcfs/include/libcfs/linux/linux-prim.h
-@@ -183,15 +183,6 @@ typedef long cfs_task_state_t;
-
- #define CFS_DECL_WAITQ(wq) DECLARE_WAIT_QUEUE_HEAD(wq)
-
--#define cfs_kthread_run(fn, data, fmt, arg...) kthread_run(fn, data, fmt, ##arg)
--
--/* Kernel thread */
--typedef int (*cfs_thread_t)(void *);
--
--#define CFS_DAEMON_FLAGS (CLONE_VM | CLONE_FILES)
--extern int cfs_create_thread(int (*fn)(void *),
-- void *arg, unsigned long flags);
--
- /*
- * Task struct
- */
-diff --git a/libcfs/include/libcfs/posix/libcfs.h b/libcfs/include/libcfs/posix/libcfs.h
-index 64cfbc7..305b74b 100644
---- a/libcfs/include/libcfs/posix/libcfs.h
-+++ b/libcfs/include/libcfs/posix/libcfs.h
-@@ -110,6 +110,7 @@
- typedef unsigned long long cfs_cycles_t;
-
- #define IS_ERR(a) ((unsigned long)(a) > (unsigned long)-1000L)
-+#define IS_ERR_VALUE(a) (IS_ERR(a))
- #define PTR_ERR(a) ((long)(a))
- #define ERR_PTR(a) ((void*)((long)(a)))
-
-diff --git a/libcfs/include/libcfs/user-prim.h b/libcfs/include/libcfs/user-prim.h
-index 85253d8..c4e806c 100644
---- a/libcfs/include/libcfs/user-prim.h
-+++ b/libcfs/include/libcfs/user-prim.h
-@@ -157,9 +157,10 @@ static inline int cfs_psdev_deregister(cfs_psdev_t *foo)
-
- #ifdef HAVE_LIBPTHREAD
- typedef int (*cfs_thread_t)(void *);
--int cfs_create_thread(cfs_thread_t func, void *arg, unsigned long flags);
-+void *kthread_run(cfs_thread_t func, void *arg, const char namefmt[], ...);
- #else
--#define cfs_create_thread(l,m) LBUG()
-+/* Fine, crash, but stop giving me compile warnings */
-+#define kthread_run(f, a, n, ...) LBUG()
- #endif
-
- uid_t cfs_curproc_uid(void);
-diff --git a/libcfs/include/libcfs/winnt/winnt-prim.h b/libcfs/include/libcfs/winnt/winnt-prim.h
-index 985af01..e234bba 100644
---- a/libcfs/include/libcfs/winnt/winnt-prim.h
-+++ b/libcfs/include/libcfs/winnt/winnt-prim.h
-@@ -442,8 +442,6 @@ typedef struct _cfs_thread_context {
- void * arg;
- } cfs_thread_context_t;
-
--int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag);
--
- /*
- * thread creation flags from Linux, not used in winnt
- */
-@@ -461,8 +459,6 @@ int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag);
-
- #define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
-
--#define CFS_DAEMON_FLAGS (CLONE_VM|CLONE_FILES)
--
- /*
- * group_info: linux/sched.h
- */
-diff --git a/libcfs/libcfs/Makefile.in b/libcfs/libcfs/Makefile.in
-index 71852cc..ddfadde 100644
---- a/libcfs/libcfs/Makefile.in
-+++ b/libcfs/libcfs/Makefile.in
-@@ -3,7 +3,7 @@ MODULES = libcfs
- libcfs-linux-objs := linux-tracefile.o linux-debug.o
- libcfs-linux-objs += linux-prim.o linux-mem.o linux-cpu.o
- libcfs-linux-objs += linux-fs.o linux-sync.o linux-tcpip.o
--libcfs-linux-objs += linux-lwt.o linux-proc.o linux-curproc.o
-+libcfs-linux-objs += linux-proc.o linux-curproc.o
- libcfs-linux-objs += linux-utils.o linux-module.o
- libcfs-linux-objs += linux-crypto.o linux-crypto-crc32.o
- libcfs-linux-objs += linux-crypto-adler.o
-@@ -29,7 +29,7 @@ sources:
-
- libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
-
--libcfs-all-objs := debug.o fail.o nidstrings.o lwt.o module.o tracefile.o \
-+libcfs-all-objs := debug.o fail.o nidstrings.o module.o tracefile.o \
- watchdog.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 heap.o
-diff --git a/libcfs/libcfs/darwin/darwin-prim.c b/libcfs/libcfs/darwin/darwin-prim.c
-index 68d1c0d..8e0901f 100644
---- a/libcfs/libcfs/darwin/darwin-prim.c
-+++ b/libcfs/libcfs/darwin/darwin-prim.c
-@@ -333,24 +333,29 @@ cfs_thread_agent (void)
-
- extern thread_t kernel_thread(task_t task, void (*start)(void));
-
--int
--cfs_create_thread(cfs_thread_t func, void *arg, unsigned long flag)
--{
-- int ret = 0;
-- thread_t th = NULL;
--
-- thread_arg_hold(&cfs_thread_arg, func, arg);
-- th = kernel_thread(kernel_task, cfs_thread_agent);
-- thread_arg_release(&cfs_thread_arg);
-- if (th == THREAD_NULL)
-+cfs_task_t
-+kthread_run(cfs_thread_t func, void *arg, const char namefmt[], ...)
-+{
-+ int ret = 0;
-+ thread_t th = NULL;
-+
-+ thread_arg_hold(&cfs_thread_arg, func, arg);
-+ th = kernel_thread(kernel_task, cfs_thread_agent);
-+ thread_arg_release(&cfs_thread_arg);
-+ if (th != THREAD_NULL) {
-+ /*
-+ * FIXME: change child thread name...
-+ * cfs_curproc_comm() is already broken. So it is left as is...
-+ va_list args;
-+ va_start(args, namefmt);
-+ snprintf(cfs_curproc_comm(), CFS_CURPROC_COMM_MAX,
-+ namefmt, args);
-+ va_end(args);
-+ */
-+ } else {
- ret = -1;
-- return ret;
--}
--
--void cfs_daemonize(char *str)
--{
-- snprintf(cfs_curproc_comm(), CFS_CURPROC_COMM_MAX, "%s", str);
-- return;
-+ }
-+ return (cfs_task_t)((long)ret);
- }
-
- /*
-diff --git a/libcfs/libcfs/darwin/darwin-utils.c b/libcfs/libcfs/darwin/darwin-utils.c
-index c66f8e8..909b586 100644
---- a/libcfs/libcfs/darwin/darwin-utils.c
-+++ b/libcfs/libcfs/darwin/darwin-utils.c
-@@ -531,7 +531,7 @@ static int is_last_frame(void *addr)
- return 1;
- else if (is_addr_in_range(addr, trap, syscall_trace))
- return 1;
-- else if (is_addr_in_range(addr, cfs_thread_agent, cfs_create_thread))
-+ else if (is_addr_in_range(addr, cfs_thread_agent, kthread_run))
- return 1;
- else
- return 0;
-diff --git a/libcfs/libcfs/debug.c b/libcfs/libcfs/debug.c
-index f503781..16a8e99 100644
---- a/libcfs/libcfs/debug.c
-+++ b/libcfs/libcfs/debug.c
-@@ -367,16 +367,16 @@ void libcfs_debug_dumplog(void)
- /* we're being careful to ensure that the kernel thread is
- * able to set our state to running as it exits before we
- * get to schedule() */
-- cfs_waitlink_init(&wait);
-- cfs_set_current_state(CFS_TASK_INTERRUPTIBLE);
-- cfs_waitq_add(&debug_ctlwq, &wait);
--
-- dumper = cfs_kthread_run(libcfs_debug_dumplog_thread,
-- (void*)(long)cfs_curproc_pid(),
-- "libcfs_debug_dumper");
-- if (IS_ERR(dumper))
-- printk(CFS_KERN_ERR "LustreError: cannot start log dump thread:"
-- " %ld\n", PTR_ERR(dumper));
-+ cfs_waitlink_init(&wait);
-+ cfs_set_current_state(CFS_TASK_INTERRUPTIBLE);
-+ cfs_waitq_add(&debug_ctlwq, &wait);
-+
-+ dumper = kthread_run(libcfs_debug_dumplog_thread,
-+ (void *)(long)cfs_curproc_pid(),
-+ "libcfs_debug_dumper");
-+ if (IS_ERR(dumper))
-+ printk(CFS_KERN_ERR "LustreError: cannot start log dump thread:"
-+ " %ld\n", PTR_ERR(dumper));
- else
- cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);
-
-diff --git a/libcfs/libcfs/linux/Makefile.am b/libcfs/libcfs/linux/Makefile.am
-index bb75462..3c0209f 100644
---- a/libcfs/libcfs/linux/Makefile.am
-+++ b/libcfs/libcfs/linux/Makefile.am
-@@ -1,4 +1,4 @@
--EXTRA_DIST = linux-debug.c linux-lwt.c linux-prim.c linux-tracefile.c \
-+EXTRA_DIST = linux-debug.c linux-prim.c linux-tracefile.c \
- linux-fs.c linux-mem.c linux-proc.c linux-utils.c linux-lock.c \
- linux-module.c linux-sync.c linux-curproc.c linux-tcpip.c \
- linux-cpu.c linux-crypto.c linux-crypto-crc32.c linux-crypto-adler.c \
-diff --git a/libcfs/libcfs/linux/linux-lwt.c b/libcfs/libcfs/linux/linux-lwt.c
-deleted file mode 100644
-index d9d4dc1..0000000
---- a/libcfs/libcfs/linux/linux-lwt.c
-+++ /dev/null
-@@ -1,81 +0,0 @@
--/*
-- * GPL HEADER START
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License version 2 only,
-- * as published by the Free Software Foundation.
-- *
-- * This program is distributed in the hope that it will be useful, but
-- * WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * General Public License version 2 for more details (a copy is included
-- * in the LICENSE file that accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License
-- * version 2 along with this program; If not, see
-- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
-- *
-- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-- * CA 95054 USA or visit www.sun.com if you need additional information or
-- * have any questions.
-- *
-- * GPL HEADER END
-- */
--/*
-- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-- * Use is subject to license terms.
-- *
-- * Copyright (c) 2012, Intel Corporation.
-- */
--/*
-- * This file is part of Lustre, http://www.lustre.org/
-- * Lustre is a trademark of Sun Microsystems, Inc.
-- */
--
--# define DEBUG_SUBSYSTEM S_LNET
--#include <linux/module.h>
--#include <linux/sched.h>
--#include <linux/spinlock.h>
--
--#ifdef HAVE_LINUX_OOM_H
--#include <linux/oom.h>
--#else
--#include <linux/mm.h>
--#endif
--
--int oom_get_adj(struct task_struct *task, int scope)
--{
-- int oom_adj;
--#ifdef HAVE_OOMADJ_IN_SIG
-- unsigned long flags;
--
-- spin_lock_irqsave(&task->sighand->siglock, flags);
-- oom_adj = task->signal->oom_adj;
-- task->signal->oom_adj = scope;
-- spin_unlock_irqrestore(&task->sighand->siglock, flags);
--
--#else
-- oom_adj = task->oomkilladj;
-- task->oomkilladj = scope;
--#endif
-- return oom_adj;
--}
--
--int cfs_create_thread(int (*fn)(void *),
-- void *arg, unsigned long flags)
--{
-- void *orig_info = current->journal_info;
-- int rc;
-- int old_oom;
--
-- old_oom = oom_get_adj(current, OOM_DISABLE);
-- current->journal_info = NULL;
-- rc = kernel_thread(fn, arg, flags);
-- current->journal_info = orig_info;
-- oom_get_adj(current, old_oom);
--
-- return rc;
--}
--EXPORT_SYMBOL(cfs_create_thread);
-diff --git a/libcfs/libcfs/linux/linux-prim.c b/libcfs/libcfs/linux/linux-prim.c
-index 43b172e..9e2de0e 100644
---- a/libcfs/libcfs/linux/linux-prim.c
-+++ b/libcfs/libcfs/linux/linux-prim.c
-@@ -259,34 +259,20 @@ void cfs_enter_debugger(void)
- #endif
- }
-
--void cfs_daemonize(char *str) {
-- unsigned long flags;
--
-- daemonize(str);
-- SIGNAL_MASK_LOCK(current, flags);
-- sigfillset(¤t->blocked);
-- RECALC_SIGPENDING;
-- SIGNAL_MASK_UNLOCK(current, flags);
--}
--
--int cfs_daemonize_ctxt(char *str) {
--
-- cfs_daemonize(str);
- #ifndef HAVE_UNSHARE_FS_STRUCT
-- {
-- struct task_struct *tsk = current;
-- struct fs_struct *fs = NULL;
-- fs = copy_fs_struct(tsk->fs);
-- if (fs == NULL)
-- return -ENOMEM;
-- exit_fs(tsk);
-- tsk->fs = fs;
-- }
--#else
-- unshare_fs_struct();
-+int unshare_fs_struct(void)
-+{
-+ struct task_struct *tsk = current;
-+ struct fs_struct *fs = NULL;
-+ fs = copy_fs_struct(tsk->fs);
-+ if (fs == NULL)
-+ return -ENOMEM;
-+ exit_fs(tsk);
-+ tsk->fs = fs;
-+ return 0;
-+}
-+EXPORT_SYMBOL(unshare_fs_struct);
- #endif
-- return 0;
--}
-
- sigset_t
- cfs_block_allsigs(void)
-@@ -373,8 +359,6 @@ libcfs_arch_cleanup(void)
- EXPORT_SYMBOL(libcfs_arch_init);
- EXPORT_SYMBOL(libcfs_arch_cleanup);
- EXPORT_SYMBOL(cfs_enter_debugger);
--EXPORT_SYMBOL(cfs_daemonize);
--EXPORT_SYMBOL(cfs_daemonize_ctxt);
- EXPORT_SYMBOL(cfs_block_allsigs);
- EXPORT_SYMBOL(cfs_block_sigs);
- EXPORT_SYMBOL(cfs_block_sigsinv);
-diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c
-index 916bdc9..2049908 100644
---- a/libcfs/libcfs/tracefile.c
-+++ b/libcfs/libcfs/tracefile.c
-@@ -992,7 +992,6 @@ static int tracefiled(void *arg)
-
- /* we're started late enough that we pick up init's fs context */
- /* this is so broken in uml? what on earth is going on? */
-- cfs_daemonize("ktracefiled");
-
- spin_lock_init(&pc.pc_lock);
- complete(&tctl->tctl_start);
-@@ -1106,16 +1105,16 @@ int cfs_trace_start_thread(void)
-
- init_completion(&tctl->tctl_start);
- init_completion(&tctl->tctl_stop);
-- cfs_waitq_init(&tctl->tctl_waitq);
-- cfs_atomic_set(&tctl->tctl_shutdown, 0);
-+ cfs_waitq_init(&tctl->tctl_waitq);
-+ cfs_atomic_set(&tctl->tctl_shutdown, 0);
-
-- if (cfs_create_thread(tracefiled, tctl, 0) < 0) {
-- rc = -ECHILD;
-- goto out;
-- }
-+ if (IS_ERR(kthread_run(tracefiled, tctl, "ktracefiled"))) {
-+ rc = -ECHILD;
-+ goto out;
-+ }
-
- wait_for_completion(&tctl->tctl_start);
-- thread_running = 1;
-+ thread_running = 1;
- out:
- mutex_unlock(&cfs_trace_thread_mutex);
- return rc;
-diff --git a/libcfs/libcfs/user-prim.c b/libcfs/libcfs/user-prim.c
-index eb21418..9f2b7b3 100644
---- a/libcfs/libcfs/user-prim.c
-+++ b/libcfs/libcfs/user-prim.c
-@@ -223,24 +223,25 @@ static void *cfs_thread_helper(void *data)
- return NULL;
- }
-
--int cfs_create_thread(cfs_thread_t func, void *arg, unsigned long flags)
-+void *kthread_run(cfs_thread_t func, void *arg, const char namefmt[], ...)
- {
-- pthread_t tid;
-- pthread_attr_t tattr;
-- int rc;
-- struct lustre_thread_arg *targ_p = malloc(sizeof(struct lustre_thread_arg));
-+ pthread_t tid;
-+ pthread_attr_t tattr;
-+ int rc;
-+ struct lustre_thread_arg *targ_p =
-+ malloc(sizeof(struct lustre_thread_arg));
-
-- if ( targ_p == NULL )
-- return -ENOMEM;
-+ if (targ_p == NULL)
-+ return ERR_PTR(-ENOMEM);
-
-- targ_p->f = func;
-- targ_p->arg = arg;
-+ targ_p->f = func;
-+ targ_p->arg = arg;
-
-- pthread_attr_init(&tattr);
-- pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
-- rc = pthread_create(&tid, &tattr, cfs_thread_helper, targ_p);
-- pthread_attr_destroy(&tattr);
-- return -rc;
-+ pthread_attr_init(&tattr);
-+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
-+ rc = pthread_create(&tid, &tattr, cfs_thread_helper, targ_p);
-+ pthread_attr_destroy(&tattr);
-+ return ERR_PTR(rc);
- }
- #endif
-
-@@ -314,14 +315,9 @@ void cfs_enter_debugger(void)
- */
- }
-
--void cfs_daemonize(char *str)
-+int unshare_fs_struct()
- {
-- return;
--}
--
--int cfs_daemonize_ctxt(char *str)
--{
-- return 0;
-+ return 0;
- }
-
- cfs_sigset_t cfs_block_allsigs(void)
-diff --git a/libcfs/libcfs/watchdog.c b/libcfs/libcfs/watchdog.c
-index e08fe68..0981a2c 100644
---- a/libcfs/libcfs/watchdog.c
-+++ b/libcfs/libcfs/watchdog.c
-@@ -213,19 +213,11 @@ static void lcw_dump_stack(struct lc_watchdog *lcw)
- static int lcw_dispatch_main(void *data)
- {
- int rc = 0;
-- unsigned long flags;
- struct lc_watchdog *lcw;
- CFS_LIST_HEAD (zombies);
-
- ENTRY;
-
-- cfs_daemonize("lc_watchdogd");
--
-- SIGNAL_MASK_LOCK(current, flags);
-- sigfillset(¤t->blocked);
-- RECALC_SIGPENDING;
-- SIGNAL_MASK_UNLOCK(current, flags);
--
- complete(&lcw_start_completion);
-
- while (1) {
-@@ -312,7 +304,7 @@ static int lcw_dispatch_main(void *data)
-
- static void lcw_dispatch_start(void)
- {
-- int rc;
-+ cfs_task_t *task;
-
- ENTRY;
- LASSERT(lcw_refcount == 1);
-@@ -321,13 +313,14 @@ static void lcw_dispatch_start(void)
- init_completion(&lcw_start_completion);
- cfs_waitq_init(&lcw_event_waitq);
-
-- CDEBUG(D_INFO, "starting dispatch thread\n");
-- rc = cfs_create_thread(lcw_dispatch_main, NULL, 0);
-- if (rc < 0) {
-- CERROR("error spawning watchdog dispatch thread: %d\n", rc);
-- EXIT;
-- return;
-- }
-+ CDEBUG(D_INFO, "starting dispatch thread\n");
-+ task = kthread_run(lcw_dispatch_main, NULL, "lc_watchdogd");
-+ if (IS_ERR(task)) {
-+ CERROR("error spawning watchdog dispatch thread: %ld\n",
-+ PTR_ERR(task));
-+ EXIT;
-+ return;
-+ }
- wait_for_completion(&lcw_start_completion);
- CDEBUG(D_INFO, "watchdog dispatcher initialization complete.\n");
-
-diff --git a/libcfs/libcfs/winnt/winnt-prim.c b/libcfs/libcfs/winnt/winnt-prim.c
-index 8596a40..1d04567 100644
---- a/libcfs/libcfs/winnt/winnt-prim.c
-+++ b/libcfs/libcfs/winnt/winnt-prim.c
-@@ -82,22 +82,22 @@ cfs_thread_proc(
- }
-
- /*
-- * cfs_create_thread
-+ * kthread_run
- * Create a system thread to execute the routine specified
- *
- * Arguments:
- * func: function to be executed in the thread
- * arg: argument transferred to func function
-- * flag: thread creation flags.
-+ * name: thread name to create
- *
- * Return Value:
-- * int: 0 on success or error codes
-+ * cfs_task_t: 0 on success or error codes
- *
- * Notes:
- * N/A
- */
-
--int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag)
-+cfs_task_t kthread_run(int (*func)(void *), void *arg, char *name)
- {
- cfs_handle_t thread = NULL;
- NTSTATUS status;
-@@ -108,7 +108,7 @@ int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag)
- context = cfs_alloc(sizeof(cfs_thread_context_t), CFS_ALLOC_ZERO);
-
- if (!context) {
-- return -ENOMEM;
-+ return ERR_PTR(-ENOMEM);
- }
-
- context->func = func;
-@@ -130,7 +130,7 @@ int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag)
-
- /* We need translate the nt status to linux error code */
-
-- return cfs_error_code(status);
-+ return ERR_PTR(cfs_error_code(status));
- }
-
- //
-@@ -139,7 +139,7 @@ int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag)
-
- ZwClose(thread);
-
-- return 0;
-+ return (cfs_task_t)0;
- }
-
-
-@@ -529,18 +529,9 @@ cfs_time_t cfs_timer_deadline(cfs_timer_t * timer)
- return timer->deadline;
- }
-
--/*
-- * daemonize routine stub
-- */
--
--void cfs_daemonize(char *str)
-+int unshare_fs_struct()
- {
-- return;
--}
--
--int cfs_daemonize_ctxt(char *str) {
-- cfs_daemonize(str);
-- return 0;
-+ return 0;
- }
-
- /*
-diff --git a/libcfs/libcfs/winnt/winnt-tcpip.c b/libcfs/libcfs/winnt/winnt-tcpip.c
-index 6fbf0a5..50d784f 100644
---- a/libcfs/libcfs/winnt/winnt-tcpip.c
-+++ b/libcfs/libcfs/winnt/winnt-tcpip.c
-@@ -5898,10 +5898,10 @@ ks_init_tdi_data()
- }
- for (i = 0; i < ks_data.ksnd_engine_nums; i++) {
- spin_lock_init(&ks_data.ksnd_engine_mgr[i].lock);
-- cfs_init_event(&ks_data.ksnd_engine_mgr[i].start, TRUE, FALSE);
-- cfs_init_event(&ks_data.ksnd_engine_mgr[i].exit, TRUE, FALSE);
-- CFS_INIT_LIST_HEAD(&ks_data.ksnd_engine_mgr[i].list);
-- cfs_create_thread(KsDeliveryEngineThread, &ks_data.ksnd_engine_mgr[i], 0);
-+ cfs_init_event(&ks_data.ksnd_engine_mgr[i].start, TRUE, FALSE);
-+ cfs_init_event(&ks_data.ksnd_engine_mgr[i].exit, TRUE, FALSE);
-+ CFS_INIT_LIST_HEAD(&ks_data.ksnd_engine_mgr[i].list);
-+ kthread_run(KsDeliveryEngineThread, &ks_data.ksnd_engine_mgr[i], "");
- }
-
- /* register pnp handlers to watch network condition */
-diff --git a/libcfs/libcfs/workitem.c b/libcfs/libcfs/workitem.c
-index db839e5..309cfec 100644
---- a/libcfs/libcfs/workitem.c
-+++ b/libcfs/libcfs/workitem.c
-@@ -245,17 +245,7 @@ static int
- cfs_wi_scheduler (void *arg)
- {
- struct cfs_wi_sched *sched = (cfs_wi_sched_t *)arg;
-- char name[16];
--
-- if (sched->ws_cptab != NULL && sched->ws_cpt >= 0) {
-- snprintf(name, sizeof(name), "%s_%02d_%02d",
-- sched->ws_name, sched->ws_cpt, sched->ws_nthreads);
-- } else {
-- snprintf(name, sizeof(name), "%s_%02d",
-- sched->ws_name, sched->ws_nthreads);
-- }
-
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- /* CPT affinity scheduler? */
-@@ -463,6 +453,8 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
- rc = 0;
- #ifdef __KERNEL__
- while (nthrs > 0) {
-+ char name[16];
-+ cfs_task_t *task;
- spin_lock(&cfs_wi_data.wi_glock);
- while (sched->ws_starting > 0) {
- spin_unlock(&cfs_wi_data.wi_glock);
-@@ -473,11 +465,21 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
- sched->ws_starting++;
- spin_unlock(&cfs_wi_data.wi_glock);
-
-- rc = cfs_create_thread(cfs_wi_scheduler, sched, 0);
-- if (rc >= 0) {
-+ if (sched->ws_cptab != NULL && sched->ws_cpt >= 0) {
-+ snprintf(name, sizeof(name), "%s_%02d_%02d",
-+ sched->ws_name, sched->ws_cpt,
-+ sched->ws_nthreads);
-+ } else {
-+ snprintf(name, sizeof(name), "%s_%02d",
-+ sched->ws_name, sched->ws_nthreads);
-+ }
-+
-+ task = kthread_run(cfs_wi_scheduler, sched, name);
-+ if (!IS_ERR(task)) {
- nthrs--;
- continue;
- }
-+ rc = PTR_ERR(task);
-
- CERROR("Failed to create thread for WI scheduler %s: %d\n",
- name, rc);
-diff --git a/lnet/klnds/gnilnd/gnilnd_cb.c b/lnet/klnds/gnilnd/gnilnd_cb.c
-index 381aa64..3c0f472 100644
---- a/lnet/klnds/gnilnd/gnilnd_cb.c
-+++ b/lnet/klnds/gnilnd/gnilnd_cb.c
-@@ -2946,7 +2946,6 @@ kgnilnd_reaper(void *arg)
- struct timer_list timer;
- DEFINE_WAIT(wait);
-
-- cfs_daemonize("kgnilnd_rpr");
- cfs_block_allsigs();
-
- /* all gnilnd threads need to run fairly urgently */
-@@ -4850,15 +4849,12 @@ kgnilnd_scheduler(void *arg)
- {
- int threadno = (long)arg;
- kgn_device_t *dev;
-- char name[16];
- int busy_loops = 0;
- unsigned long deadline = 0;
- DEFINE_WAIT(wait);
-
- dev = &kgnilnd_data.kgn_devices[(threadno + 1) % kgnilnd_data.kgn_ndevs];
-
-- snprintf(name, sizeof(name), "kgnilnd_sd_%02d", threadno);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- /* all gnilnd threads need to run fairly urgently */
-diff --git a/lnet/klnds/gnilnd/gnilnd_conn.c b/lnet/klnds/gnilnd/gnilnd_conn.c
-index 39716b8..a513ccd 100644
---- a/lnet/klnds/gnilnd/gnilnd_conn.c
-+++ b/lnet/klnds/gnilnd/gnilnd_conn.c
-@@ -2167,13 +2167,10 @@ int
- kgnilnd_dgram_waitq(void *arg)
- {
- kgn_device_t *dev = (kgn_device_t *) arg;
-- char name[16];
- gni_return_t grc;
- __u64 readyid;
- DEFINE_WAIT(mover_done);
-
-- snprintf(name, sizeof(name), "kgnilnd_dgn_%02d", dev->gnd_id);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- /* all gnilnd threads need to run fairly urgently */
-@@ -2345,7 +2342,6 @@ int
- kgnilnd_dgram_mover(void *arg)
- {
- kgn_device_t *dev = (kgn_device_t *)arg;
-- char name[16];
- int rc, did_something;
- unsigned long next_purge_check = jiffies - 1;
- unsigned long timeout;
-@@ -2353,8 +2349,6 @@ kgnilnd_dgram_mover(void *arg)
- unsigned long deadline = 0;
- DEFINE_WAIT(wait);
-
-- snprintf(name, sizeof(name), "kgnilnd_dg_%02d", dev->gnd_id);
-- cfs_daemonize(name);
- cfs_block_allsigs();
- /* all gnilnd threads need to run fairly urgently */
- set_user_nice(current, *kgnilnd_tunables.kgn_nice);
-diff --git a/lnet/klnds/gnilnd/gnilnd_stack.c b/lnet/klnds/gnilnd/gnilnd_stack.c
-index 0dec950..6b93025 100644
---- a/lnet/klnds/gnilnd/gnilnd_stack.c
-+++ b/lnet/klnds/gnilnd/gnilnd_stack.c
-@@ -366,7 +366,6 @@ kgnilnd_ruhroh_thread(void *arg)
- int i = 1;
- DEFINE_WAIT(wait);
-
-- cfs_daemonize("kgnilnd_rr");
- cfs_block_allsigs();
- set_user_nice(current, *kgnilnd_tunables.kgn_nice);
- kgnilnd_data.kgn_ruhroh_running = 1;
-@@ -592,7 +591,6 @@ kgnilnd_rca(void *arg)
- rs_event_t event;
- lnet_nid_t nid;
-
-- cfs_daemonize("kgnilnd_rca");
- cfs_block_allsigs();
-
- /* all gnilnd threads need to run fairly urgently */
-diff --git a/lnet/klnds/mxlnd/mxlnd.c b/lnet/klnds/mxlnd/mxlnd.c
-index 558bfaf..dbe998f 100644
---- a/lnet/klnds/mxlnd/mxlnd.c
-+++ b/lnet/klnds/mxlnd/mxlnd.c
-@@ -385,24 +385,25 @@ failed_with_init:
- * mxlnd_thread_start - spawn a kernel thread with this function
- * @fn - function pointer
- * @arg - pointer to the parameter data
-+ * @name - name of new thread
- *
- * Returns 0 on success and a negative value on failure
- */
- int
--mxlnd_thread_start(int (*fn)(void *arg), void *arg)
-+mxlnd_thread_start(int (*fn)(void *arg), void *arg, char *name)
- {
-- int pid = 0;
-+ cfs_task *task;
- int i = (int) ((long) arg);
-
- cfs_atomic_inc(&kmxlnd_data.kmx_nthreads);
- init_completion(&kmxlnd_data.kmx_completions[i]);
-
-- pid = cfs_create_thread(fn, arg, 0);
-- if (pid < 0) {
-- CERROR("cfs_create_thread() failed with %d\n", pid);
-- cfs_atomic_dec(&kmxlnd_data.kmx_nthreads);
-- }
-- return pid;
-+ task = kthread_run(fn, arg, name);
-+ if (IS_ERR(task)) {
-+ CERROR("cfs_create_thread() failed with %d\n", PTR_ERR(task));
-+ cfs_atomic_dec(&kmxlnd_data.kmx_nthreads);
-+ }
-+ return PTR_ERR(task);
- }
-
- /**
-@@ -616,9 +617,13 @@ mxlnd_startup (lnet_ni_t *ni)
- *kmxlnd_tunables.kmx_n_waitd == 1 ? "thread" : "threads");
-
- for (i = 0; i < *kmxlnd_tunables.kmx_n_waitd; i++) {
-+ char name[24];
-+ memset(name, 0, sizeof(name));
-+ snprintf(name, sizeof(name), "mxlnd_request_waitd_%02ld", i);
- ret = mxlnd_thread_start(mxlnd_request_waitd, (void*)((long)i));
-- if (ret < 0) {
-- CERROR("Starting mxlnd_request_waitd[%d] failed with %d\n", i, ret);
-+ if (ret < 0) {
-+ CERROR("Starting mxlnd_request_waitd[%d] "
-+ "failed with %d\n", i, ret);
- cfs_atomic_set(&kmxlnd_data.kmx_shutdown, 1);
- mx_wakeup(kmxlnd_data.kmx_endpt);
- for (--i; i >= 0; i--) {
-@@ -631,7 +636,8 @@ mxlnd_startup (lnet_ni_t *ni)
- goto failed;
- }
- }
-- ret = mxlnd_thread_start(mxlnd_tx_queued, (void*)((long)i++));
-+ ret = mxlnd_thread_start(mxlnd_tx_queued, (void *)((long)i++),
-+ "mxlnd_tx_queued");
- if (ret < 0) {
- CERROR("Starting mxlnd_tx_queued failed with %d\n", ret);
- cfs_atomic_set(&kmxlnd_data.kmx_shutdown, 1);
-@@ -644,7 +650,8 @@ mxlnd_startup (lnet_ni_t *ni)
- nthreads * sizeof(struct completion));
- goto failed;
- }
-- ret = mxlnd_thread_start(mxlnd_timeoutd, (void*)((long)i++));
-+ ret = mxlnd_thread_start(mxlnd_timeoutd, (void *)((long)i++),
-+ "mxlnd_timeoutd");
- if (ret < 0) {
- CERROR("Starting mxlnd_timeoutd failed with %d\n", ret);
- cfs_atomic_set(&kmxlnd_data.kmx_shutdown, 1);
-@@ -658,7 +665,8 @@ mxlnd_startup (lnet_ni_t *ni)
- nthreads * sizeof(struct completion));
- goto failed;
- }
-- ret = mxlnd_thread_start(mxlnd_connd, (void*)((long)i++));
-+ ret = mxlnd_thread_start(mxlnd_connd, (void *)((long)i++),
-+ "mxlnd_connd");
- if (ret < 0) {
- CERROR("Starting mxlnd_connd failed with %d\n", ret);
- cfs_atomic_set(&kmxlnd_data.kmx_shutdown, 1);
-diff --git a/lnet/klnds/mxlnd/mxlnd_cb.c b/lnet/klnds/mxlnd/mxlnd_cb.c
-index 5b67392..4b3961b 100644
---- a/lnet/klnds/mxlnd/mxlnd_cb.c
-+++ b/lnet/klnds/mxlnd/mxlnd_cb.c
-@@ -2554,8 +2554,6 @@ mxlnd_tx_queued(void *arg)
- spinlock_t *tx_q_lock = &kmxlnd_data.kmx_tx_queue_lock;
- rwlock_t *g_lock = &kmxlnd_data.kmx_global_lock;
-
-- cfs_daemonize("mxlnd_tx_queued");
--
- while (!(cfs_atomic_read(&kmxlnd_data.kmx_shutdown))) {
- ret = down_interruptible(&kmxlnd_data.kmx_tx_queue_sem);
- if (cfs_atomic_read(&kmxlnd_data.kmx_shutdown))
-@@ -3485,7 +3483,6 @@ int
- mxlnd_request_waitd(void *arg)
- {
- long id = (long) arg;
-- char name[24];
- __u32 result = 0;
- mx_return_t mxret = MX_SUCCESS;
- mx_status_t status;
-@@ -3497,10 +3494,6 @@ mxlnd_request_waitd(void *arg)
- int count = 0;
- #endif
-
-- memset(name, 0, sizeof(name));
-- snprintf(name, sizeof(name), "mxlnd_request_waitd_%02ld", id);
-- cfs_daemonize(name);
--
- memset(&status, 0, sizeof(status));
-
- CDEBUG(D_NET, "%s starting\n", name);
-@@ -3965,8 +3958,6 @@ mxlnd_connd(void *arg)
- {
- long id = (long) arg;
-
-- cfs_daemonize("mxlnd_connd");
--
- CDEBUG(D_NET, "connd starting\n");
-
- while (!(cfs_atomic_read(&kmxlnd_data.kmx_shutdown))) {
-@@ -4040,8 +4031,6 @@ mxlnd_timeoutd(void *arg)
- kmx_conn_t *conn = NULL;
- rwlock_t *g_lock = &kmxlnd_data.kmx_global_lock;
-
-- cfs_daemonize("mxlnd_timeoutd");
--
- CDEBUG(D_NET, "timeoutd starting\n");
-
- while (!(cfs_atomic_read(&kmxlnd_data.kmx_shutdown))) {
-diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
-index 7d3c025..86298dd 100644
---- a/lnet/klnds/o2iblnd/o2iblnd.c
-+++ b/lnet/klnds/o2iblnd/o2iblnd.c
-@@ -3011,14 +3011,15 @@ kiblnd_base_startup(void)
- kiblnd_data.kib_init = IBLND_INIT_DATA;
- /*****************************************************/
-
-- rc = kiblnd_thread_start(kiblnd_connd, NULL);
-+ rc = kiblnd_thread_start(kiblnd_connd, NULL, "kiblnd_connd");
- if (rc != 0) {
- CERROR("Can't spawn o2iblnd connd: %d\n", rc);
- goto failed;
- }
-
-- if (*kiblnd_tunables.kib_dev_failover != 0)
-- rc = kiblnd_thread_start(kiblnd_failover_thread, NULL);
-+ if (*kiblnd_tunables.kib_dev_failover != 0)
-+ rc = kiblnd_thread_start(kiblnd_failover_thread, NULL,
-+ "kiblnd_failover");
-
- if (rc != 0) {
- CERROR("Can't spawn o2iblnd failover thread: %d\n", rc);
-@@ -3060,9 +3061,11 @@ kiblnd_start_schedulers(struct kib_sched_info *sched)
-
- for (i = 0; i < nthrs; i++) {
- long id;
--
-+ char name[20];
- id = KIB_THREAD_ID(sched->ibs_cpt, sched->ibs_nthreads + i);
-- rc = kiblnd_thread_start(kiblnd_scheduler, (void *)id);
-+ snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld",
-+ KIB_THREAD_CPT(id), KIB_THREAD_TID(id));
-+ rc = kiblnd_thread_start(kiblnd_scheduler, (void *)id, name);
- if (rc == 0)
- continue;
-
-diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
-index fee5273..1c92fee 100644
---- a/lnet/klnds/o2iblnd/o2iblnd.h
-+++ b/lnet/klnds/o2iblnd/o2iblnd.h
-@@ -1067,7 +1067,7 @@ void kiblnd_tunables_fini(void);
-
- int kiblnd_connd (void *arg);
- int kiblnd_scheduler(void *arg);
--int kiblnd_thread_start (int (*fn)(void *arg), void *arg);
-+int kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name);
- int kiblnd_failover_thread (void *arg);
-
- int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages);
-diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
-index 3cc7985..af92311 100644
---- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
-+++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
-@@ -1805,15 +1805,15 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
- }
-
- int
--kiblnd_thread_start (int (*fn)(void *arg), void *arg)
-+kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name)
- {
-- long pid = cfs_create_thread (fn, arg, 0);
-+ cfs_task_t *task = kthread_run(fn, arg, name);
-
-- if (pid < 0)
-- return ((int)pid);
-+ if (IS_ERR(task))
-+ return PTR_ERR(task);
-
-- cfs_atomic_inc (&kiblnd_data.kib_nthreads);
-- return (0);
-+ cfs_atomic_inc(&kiblnd_data.kib_nthreads);
-+ return 0;
- }
-
- void
-@@ -3135,7 +3135,6 @@ kiblnd_connd (void *arg)
- int peer_index = 0;
- unsigned long deadline = jiffies;
-
-- cfs_daemonize ("kiblnd_connd");
- cfs_block_allsigs ();
-
- cfs_waitlink_init (&wait);
-@@ -3329,15 +3328,10 @@ kiblnd_scheduler(void *arg)
- cfs_waitlink_t wait;
- unsigned long flags;
- struct ib_wc wc;
-- char name[20];
- int did_something;
- int busy_loops = 0;
- int rc;
-
-- snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld",
-- KIB_THREAD_CPT(id), KIB_THREAD_TID(id));
--
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- cfs_waitlink_init(&wait);
-@@ -3346,10 +3340,10 @@ kiblnd_scheduler(void *arg)
-
- rc = cfs_cpt_bind(lnet_cpt_table(), sched->ibs_cpt);
- if (rc != 0) {
-- CWARN("Failed to bind %s on CPT %d, please verify whether "
-+ CWARN("Failed to bind on CPT %d, please verify whether "
- "all CPUs are healthy and reload modules if necessary, "
- "otherwise your system might under risk of low "
-- "performance\n", name, sched->ibs_cpt);
-+ "performance\n", sched->ibs_cpt);
- }
-
- spin_lock_irqsave(&sched->ibs_lock, flags);
-@@ -3464,7 +3458,6 @@ kiblnd_failover_thread(void *arg)
-
- LASSERT (*kiblnd_tunables.kib_dev_failover != 0);
-
-- cfs_daemonize ("kiblnd_failover");
- cfs_block_allsigs ();
-
- cfs_waitlink_init(&wait);
-diff --git a/lnet/klnds/ptllnd/ptllnd.c b/lnet/klnds/ptllnd/ptllnd.c
-index 791f5c2..2edf87d 100644
---- a/lnet/klnds/ptllnd/ptllnd.c
-+++ b/lnet/klnds/ptllnd/ptllnd.c
-@@ -643,6 +643,7 @@ kptllnd_base_startup (void)
- struct timeval tv;
- lnet_process_id_t target;
- ptl_err_t ptl_rc;
-+ char name[16];
-
- if (*kptllnd_tunables.kptl_max_procs_per_node < 1) {
- CERROR("max_procs_per_node must be >= 1\n");
-@@ -824,6 +825,7 @@ kptllnd_base_startup (void)
- * now that PTLLND_INIT_DATA state has been entered */
- CDEBUG(D_NET, "starting %d scheduler threads\n", PTLLND_N_SCHED);
- for (i = 0; i < PTLLND_N_SCHED; i++) {
-+ snprintf(name, sizeof(name), "kptllnd_sd_%02d", i);
- rc = kptllnd_thread_start(kptllnd_scheduler, (void *)((long)i));
- if (rc != 0) {
- CERROR("Can't spawn scheduler[%d]: %d\n", i, rc);
-@@ -831,7 +833,8 @@ kptllnd_base_startup (void)
- }
- }
-
-- rc = kptllnd_thread_start(kptllnd_watchdog, NULL);
-+ snprintf(name, sizeof(name), "kptllnd_wd_%02d", i);
-+ rc = kptllnd_thread_start(kptllnd_watchdog, NULL, name);
- if (rc != 0) {
- CERROR("Can't spawn watchdog: %d\n", rc);
- goto failed;
-diff --git a/lnet/klnds/ptllnd/ptllnd_cb.c b/lnet/klnds/ptllnd/ptllnd_cb.c
-index e815607..7be7e4d 100644
---- a/lnet/klnds/ptllnd/ptllnd_cb.c
-+++ b/lnet/klnds/ptllnd/ptllnd_cb.c
-@@ -651,26 +651,24 @@ kptllnd_thread_fini (void)
- }
-
- int
--kptllnd_thread_start (int (*fn)(void *arg), void *arg)
-+kptllnd_thread_start(int (*fn)(void *arg), void *arg, char *name)
- {
-- long pid;
-+ cfs_task_t *task;
-
-- cfs_atomic_inc(&kptllnd_data.kptl_nthreads);
-+ cfs_atomic_inc(&kptllnd_data.kptl_nthreads);
-
-- pid = cfs_create_thread (fn, arg, 0);
-- if (pid >= 0)
-- return 0;
--
-- CERROR("Failed to start thread: error %d\n", (int)pid);
-- kptllnd_thread_fini();
-- return (int)pid;
-+ task = kthread_run(fn, arg, name);
-+ if (IS_ERR(task)) {
-+ CERROR("Failed to start thread: error %ld\n", PTR_ERR(task));
-+ kptllnd_thread_fini();
-+ }
-+ return PTR_ERR(task);
- }
-
- int
- kptllnd_watchdog(void *arg)
- {
- int id = (long)arg;
-- char name[16];
- cfs_waitlink_t waitlink;
- int stamp = 0;
- int peer_index = 0;
-@@ -678,8 +676,6 @@ kptllnd_watchdog(void *arg)
- int timeout;
- int i;
-
-- snprintf(name, sizeof(name), "kptllnd_wd_%02d", id);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- cfs_waitlink_init(&waitlink);
-@@ -740,7 +736,6 @@ int
- kptllnd_scheduler (void *arg)
- {
- int id = (long)arg;
-- char name[16];
- cfs_waitlink_t waitlink;
- unsigned long flags;
- int did_something;
-@@ -749,8 +744,6 @@ kptllnd_scheduler (void *arg)
- kptl_rx_buffer_t *rxb;
- kptl_tx_t *tx;
-
-- snprintf(name, sizeof(name), "kptllnd_sd_%02d", id);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- cfs_waitlink_init(&waitlink);
-diff --git a/lnet/klnds/qswlnd/qswlnd.c b/lnet/klnds/qswlnd/qswlnd.c
-index eb6c659..4df26ee 100644
---- a/lnet/klnds/qswlnd/qswlnd.c
-+++ b/lnet/klnds/qswlnd/qswlnd.c
-@@ -526,7 +526,8 @@ kqswnal_startup (lnet_ni_t *ni)
- /**********************************************************************/
- /* Spawn scheduling threads */
- for (i = 0; i < cfs_num_online_cpus(); i++) {
-- rc = kqswnal_thread_start (kqswnal_scheduler, NULL);
-+ rc = kqswnal_thread_start(kqswnal_scheduler, NULL,
-+ "kqswnal_sched");
- if (rc != 0)
- {
- CERROR ("failed to spawn scheduling thread: %d\n", rc);
-diff --git a/lnet/klnds/qswlnd/qswlnd_cb.c b/lnet/klnds/qswlnd/qswlnd_cb.c
-index 243918b..50cc744 100644
---- a/lnet/klnds/qswlnd/qswlnd_cb.c
-+++ b/lnet/klnds/qswlnd/qswlnd_cb.c
-@@ -1655,15 +1655,15 @@ kqswnal_recv (lnet_ni_t *ni,
- }
-
- int
--kqswnal_thread_start (int (*fn)(void *arg), void *arg)
-+kqswnal_thread_start(int (*fn)(void *arg), void *arg, char *name)
- {
-- long pid = cfs_create_thread (fn, arg, 0);
-+ cfs_task_t *task = cfs_thread_run(fn, arg, name);
-
-- if (pid < 0)
-- return ((int)pid);
-+ if (IS_ERR(task))
-+ return PTR_ERR(task);
-
-- cfs_atomic_inc (&kqswnal_data.kqn_nthreads);
-- return (0);
-+ cfs_atomic_inc(&kqswnal_data.kqn_nthreads);
-+ return 0;
- }
-
- void
-@@ -1682,7 +1682,6 @@ kqswnal_scheduler (void *arg)
- int counter = 0;
- int did_something;
-
-- cfs_daemonize ("kqswnal_sched");
- cfs_block_allsigs ();
-
- spin_lock_irqsave(&kqswnal_data.kqn_sched_lock, flags);
-diff --git a/lnet/klnds/ralnd/ralnd.c b/lnet/klnds/ralnd/ralnd.c
-index ca68fef..eabefae 100644
---- a/lnet/klnds/ralnd/ralnd.c
-+++ b/lnet/klnds/ralnd/ralnd.c
-@@ -1566,6 +1566,7 @@ kranal_startup (lnet_ni_t *ni)
- int rc;
- int i;
- kra_device_t *dev;
-+ char name[16];
-
- LASSERT (ni->ni_lnd == &the_kralnd);
-
-@@ -1658,14 +1659,16 @@ kranal_startup (lnet_ni_t *ni)
- if (rc != 0)
- goto failed;
-
-- rc = kranal_thread_start(kranal_reaper, NULL);
-+ rc = kranal_thread_start(kranal_reaper, NULL, "kranal_reaper");
- if (rc != 0) {
- CERROR("Can't spawn ranal reaper: %d\n", rc);
- goto failed;
- }
-
- for (i = 0; i < *kranal_tunables.kra_n_connd; i++) {
-- rc = kranal_thread_start(kranal_connd, (void *)(unsigned long)i);
-+ snprintf(name, sizeof(name), "kranal_connd_%02ld", i);
-+ rc = kranal_thread_start(kranal_connd,
-+ (void *)(unsigned long)i, name);
- if (rc != 0) {
- CERROR("Can't spawn ranal connd[%d]: %d\n",
- i, rc);
-@@ -1691,7 +1694,8 @@ kranal_startup (lnet_ni_t *ni)
-
- for (i = 0; i < kranal_data.kra_ndevs; i++) {
- dev = &kranal_data.kra_devices[i];
-- rc = kranal_thread_start(kranal_scheduler, dev);
-+ snprintf(name, sizeof(name), "kranal_sd_%02d", dev->rad_idx);
-+ rc = kranal_thread_start(kranal_scheduler, dev, name);
- if (rc != 0) {
- CERROR("Can't spawn ranal scheduler[%d]: %d\n",
- i, rc);
-diff --git a/lnet/klnds/ralnd/ralnd.h b/lnet/klnds/ralnd/ralnd.h
-index d9fd100..8b92cdc 100644
---- a/lnet/klnds/ralnd/ralnd.h
-+++ b/lnet/klnds/ralnd/ralnd.h
-@@ -452,7 +452,7 @@ extern kra_peer_t *kranal_find_peer_locked (lnet_nid_t nid);
- extern void kranal_post_fma (kra_conn_t *conn, kra_tx_t *tx);
- extern int kranal_del_peer (lnet_nid_t nid);
- extern void kranal_device_callback (RAP_INT32 devid, RAP_PVOID arg);
--extern int kranal_thread_start (int(*fn)(void *arg), void *arg);
-+extern int kranal_thread_start(int(*fn)(void *arg), void *arg, char *name);
- extern int kranal_connd (void *arg);
- extern int kranal_reaper (void *arg);
- extern int kranal_scheduler (void *arg);
-diff --git a/lnet/klnds/ralnd/ralnd_cb.c b/lnet/klnds/ralnd/ralnd_cb.c
-index 8c7f053..05de1c1 100644
---- a/lnet/klnds/ralnd/ralnd_cb.c
-+++ b/lnet/klnds/ralnd/ralnd_cb.c
-@@ -891,15 +891,13 @@ kranal_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg,
- }
-
- int
--kranal_thread_start (int(*fn)(void *arg), void *arg)
-+kranal_thread_start(int(*fn)(void *arg), void *arg, char *name)
- {
-- long pid = cfs_create_thread(fn, arg, 0);
-+ cfs_task_t *task = cfs_thread_run(fn, arg, name);
-
-- if (pid < 0)
-- return(int)pid;
--
-- cfs_atomic_inc(&kranal_data.kra_nthreads);
-- return 0;
-+ if (!IS_ERR(task))
-+ cfs_atomic_inc(&kranal_data.kra_nthreads);
-+ return PTR_ERR(task);
- }
-
- void
-@@ -1054,15 +1052,12 @@ int
- kranal_connd (void *arg)
- {
- long id = (long)arg;
-- char name[16];
- cfs_waitlink_t wait;
- unsigned long flags;
- kra_peer_t *peer;
- kra_acceptsock_t *ras;
- int did_something;
-
-- snprintf(name, sizeof(name), "kranal_connd_%02ld", id);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- cfs_waitlink_init(&wait);
-@@ -1159,7 +1154,6 @@ kranal_reaper (void *arg)
- long next_min_timeout = CFS_MAX_SCHEDULE_TIMEOUT;
- long current_min_timeout = 1;
-
-- cfs_daemonize("kranal_reaper");
- cfs_block_allsigs();
-
- cfs_waitlink_init(&wait);
-@@ -1932,7 +1926,6 @@ kranal_scheduler (void *arg)
- {
- kra_device_t *dev = (kra_device_t *)arg;
- cfs_waitlink_t wait;
-- char name[16];
- kra_conn_t *conn;
- unsigned long flags;
- unsigned long deadline;
-@@ -1945,8 +1938,6 @@ kranal_scheduler (void *arg)
- int dropped_lock;
- int busy_loops = 0;
-
-- snprintf(name, sizeof(name), "kranal_sd_%02d", dev->rad_idx);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- dev->rad_scheduler = current;
-diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c
-index 9376b08..c70ceeb 100644
---- a/lnet/klnds/socklnd/socklnd.c
-+++ b/lnet/klnds/socklnd/socklnd.c
-@@ -2465,12 +2465,15 @@ ksocknal_base_startup(void)
- }
-
- for (i = 0; i < *ksocknal_tunables.ksnd_nconnds; i++) {
-+ char name[16];
- spin_lock_bh(&ksocknal_data.ksnd_connd_lock);
- ksocknal_data.ksnd_connd_starting++;
- spin_unlock_bh(&ksocknal_data.ksnd_connd_lock);
-
-+
-+ snprintf(name, sizeof(name), "socknal_cd%02d", i);
- rc = ksocknal_thread_start(ksocknal_connd,
-- (void *)((ulong_ptr_t)i));
-+ (void *)((ulong_ptr_t)i), name);
- if (rc != 0) {
- spin_lock_bh(&ksocknal_data.ksnd_connd_lock);
- ksocknal_data.ksnd_connd_starting--;
-@@ -2480,7 +2483,7 @@ ksocknal_base_startup(void)
- }
- }
-
-- rc = ksocknal_thread_start (ksocknal_reaper, NULL);
-+ rc = ksocknal_thread_start(ksocknal_reaper, NULL, "socknal_reaper");
- if (rc != 0) {
- CERROR ("Can't spawn socknal reaper: %d\n", rc);
- goto failed;
-@@ -2724,10 +2727,16 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)
- }
-
- for (i = 0; i < nthrs; i++) {
-- long id;
--
-+ long id;
-+ char name[20];
-+ ksock_sched_t *sched;
- id = KSOCK_THREAD_ID(info->ksi_cpt, info->ksi_nthreads + i);
-- rc = ksocknal_thread_start(ksocknal_scheduler, (void *)id);
-+ sched = &info->ksi_scheds[KSOCK_THREAD_SID(id)];
-+ snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
-+ info->ksi_cpt, (int)(sched - &info->ksi_scheds[0]));
-+
-+ rc = ksocknal_thread_start(ksocknal_scheduler,
-+ (void *)id, name);
- if (rc == 0)
- continue;
-
-diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h
-index c7f1bed..3fd04ac 100644
---- a/lnet/klnds/socklnd/socklnd.h
-+++ b/lnet/klnds/socklnd/socklnd.h
-@@ -581,7 +581,7 @@ extern void ksocknal_txlist_done (lnet_ni_t *ni, cfs_list_t *txlist,
- int error);
- extern void ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive);
- extern void ksocknal_query (struct lnet_ni *ni, lnet_nid_t nid, cfs_time_t *when);
--extern int ksocknal_thread_start (int (*fn)(void *arg), void *arg);
-+extern int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name);
- extern void ksocknal_thread_fini (void);
- extern void ksocknal_launch_all_connections_locked (ksock_peer_t *peer);
- extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t *peer);
-diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c
-index b24127d..e624753 100644
---- a/lnet/klnds/socklnd/socklnd_cb.c
-+++ b/lnet/klnds/socklnd/socklnd_cb.c
-@@ -1007,17 +1007,17 @@ ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
- }
-
- int
--ksocknal_thread_start (int (*fn)(void *arg), void *arg)
-+ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name)
- {
-- long pid = cfs_create_thread (fn, arg, 0);
-+ cfs_task_t *task = kthread_run(fn, arg, name);
-
-- if (pid < 0)
-- return ((int)pid);
-+ if (IS_ERR(task))
-+ return PTR_ERR(task);
-
- write_lock_bh(&ksocknal_data.ksnd_global_lock);
-- ksocknal_data.ksnd_nthreads++;
-+ ksocknal_data.ksnd_nthreads++;
- write_unlock_bh(&ksocknal_data.ksnd_global_lock);
-- return (0);
-+ return 0;
- }
-
- void
-@@ -1396,22 +1396,17 @@ int ksocknal_scheduler(void *arg)
- ksock_tx_t *tx;
- int rc;
- int nloops = 0;
-- char name[20];
- long id = (long)arg;
-
- info = ksocknal_data.ksnd_sched_info[KSOCK_THREAD_CPT(id)];
- sched = &info->ksi_scheds[KSOCK_THREAD_SID(id)];
-
-- snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
-- info->ksi_cpt, (int)(sched - &info->ksi_scheds[0]));
--
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- rc = cfs_cpt_bind(lnet_cpt_table(), info->ksi_cpt);
- if (rc != 0) {
-- CERROR("Can't set CPT affinity for %s to %d: %d\n",
-- name, info->ksi_cpt, rc);
-+ CERROR("Can't set CPT affinity to %d: %d\n",
-+ info->ksi_cpt, rc);
- }
-
- spin_lock_bh(&sched->kss_lock);
-@@ -2023,6 +2018,7 @@ ksocknal_connect (ksock_route_t *route)
- static int
- ksocknal_connd_check_start(long sec, long *timeout)
- {
-+ char name[16];
- int rc;
- int total = ksocknal_data.ksnd_connd_starting +
- ksocknal_data.ksnd_connd_running;
-@@ -2060,7 +2056,8 @@ ksocknal_connd_check_start(long sec, long *timeout)
- spin_unlock_bh(&ksocknal_data.ksnd_connd_lock);
-
- /* NB: total is the next id */
-- rc = ksocknal_thread_start(ksocknal_connd, (void *)((long)total));
-+ snprintf(name, sizeof(name), "socknal_cd%02d", total);
-+ rc = ksocknal_thread_start(ksocknal_connd, NULL, name);
-
- spin_lock_bh(&ksocknal_data.ksnd_connd_lock);
- if (rc == 0)
-@@ -2145,15 +2142,11 @@ int
- ksocknal_connd (void *arg)
- {
- spinlock_t *connd_lock = &ksocknal_data.ksnd_connd_lock;
-- long id = (long)(long_ptr_t)arg;
-- char name[16];
- ksock_connreq_t *cr;
- cfs_waitlink_t wait;
- int nloops = 0;
- int cons_retry = 0;
-
-- snprintf (name, sizeof (name), "socknal_cd%02ld", id);
-- cfs_daemonize (name);
- cfs_block_allsigs ();
-
- cfs_waitlink_init (&wait);
-@@ -2546,7 +2539,6 @@ ksocknal_reaper (void *arg)
- int peer_index = 0;
- cfs_time_t deadline = cfs_time_current();
-
-- cfs_daemonize ("socknal_reaper");
- cfs_block_allsigs ();
-
- CFS_INIT_LIST_HEAD(&enomem_conns);
-diff --git a/lnet/lnet/acceptor.c b/lnet/lnet/acceptor.c
-index 9e9b236..9bdac05 100644
---- a/lnet/lnet/acceptor.c
-+++ b/lnet/lnet/acceptor.c
-@@ -389,7 +389,6 @@ lnet_accept(cfs_socket_t *sock, __u32 magic)
- int
- lnet_acceptor(void *arg)
- {
-- char name[16];
- cfs_socket_t *newsock;
- int rc;
- __u32 magic;
-@@ -399,8 +398,6 @@ lnet_acceptor(void *arg)
-
- LASSERT (lnet_acceptor_state.pta_sock == NULL);
-
-- snprintf(name, sizeof(name), "acceptor_%03d", accept_port);
-- cfs_daemonize(name);
- cfs_block_allsigs();
-
- rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock,
-@@ -532,9 +529,11 @@ lnet_acceptor_start(void)
- if (lnet_count_acceptor_nis() == 0) /* not required */
- return 0;
-
-- rc2 = cfs_create_thread(lnet_acceptor, (void *)(ulong_ptr_t)secure, 0);
-- if (rc2 < 0) {
-- CERROR("Can't start acceptor thread: %d\n", rc);
-+ rc2 = PTR_ERR(kthread_run(lnet_acceptor,
-+ (void *)(ulong_ptr_t)secure,
-+ "acceptor_%03ld", secure));
-+ if (IS_ERR_VALUE(rc2)) {
-+ CERROR("Can't start acceptor thread: %ld\n", rc2);
- fini_completion(&lnet_acceptor_state.pta_signal);
-
- return -ESRCH;
-diff --git a/lnet/lnet/module.c b/lnet/lnet/module.c
-index 770345d..9d57479 100644
---- a/lnet/lnet/module.c
-+++ b/lnet/lnet/module.c
-@@ -127,11 +127,11 @@ init_lnet(void)
- rc = libcfs_register_ioctl(&lnet_ioctl_handler);
- LASSERT (rc == 0);
-
-- if (config_on_load) {
-- /* Have to schedule a separate thread to avoid deadlocking
-- * in modload */
-- (void) cfs_create_thread(lnet_configure, NULL, 0);
-- }
-+ if (config_on_load) {
-+ /* Have to schedule a separate thread to avoid deadlocking
-+ * in modload */
-+ (void) kthread_run(lnet_configure, NULL, "lnet_initd");
-+ }
-
- RETURN(0);
- }
-diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c
-index 34c94ae..4cef9e8 100644
---- a/lnet/lnet/router.c
-+++ b/lnet/lnet/router.c
-@@ -1095,16 +1095,17 @@ lnet_router_checker_start(void)
-
- the_lnet.ln_rc_state = LNET_RC_STATE_RUNNING;
- #ifdef __KERNEL__
-- rc = cfs_create_thread(lnet_router_checker, NULL, 0);
-- if (rc < 0) {
-- CERROR("Can't start router checker thread: %d\n", rc);
-- /* block until event callback signals exit */
-+ rc = PTR_ERR(kthread_run(lnet_router_checker,
-+ NULL, "router_checker"));
-+ if (IS_ERR_VALUE(rc)) {
-+ CERROR("Can't start router checker thread: %d\n", rc);
-+ /* block until event callback signals exit */
- down(&the_lnet.ln_rc_signal);
-- rc = LNetEQFree(the_lnet.ln_rc_eqh);
-- LASSERT (rc == 0);
-- the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
-- return -ENOMEM;
-- }
-+ rc = LNetEQFree(the_lnet.ln_rc_eqh);
-+ LASSERT(rc == 0);
-+ the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
-+ return -ENOMEM;
-+ }
- #endif
-
- if (check_routers_before_use) {
-@@ -1230,7 +1231,6 @@ lnet_router_checker(void *arg)
- lnet_peer_t *rtr;
- cfs_list_t *entry;
-
-- cfs_daemonize("router_checker");
- cfs_block_allsigs();
-
- LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING);
-diff --git a/lnet/selftest/timer.c b/lnet/selftest/timer.c
-index a66a336..f2f8262 100644
---- a/lnet/selftest/timer.c
-+++ b/lnet/selftest/timer.c
-@@ -183,7 +183,6 @@ stt_timer_main (void *arg)
-
- SET_BUT_UNUSED(rc);
-
-- cfs_daemonize("st_timer");
- cfs_block_allsigs();
-
- while (!stt_data.stt_shuttingdown) {
-@@ -204,13 +203,13 @@ stt_timer_main (void *arg)
- int
- stt_start_timer_thread (void)
- {
-- long pid;
-+ cfs_task_t *task;
-
-- LASSERT (!stt_data.stt_shuttingdown);
-+ LASSERT(!stt_data.stt_shuttingdown);
-
-- pid = cfs_create_thread(stt_timer_main, NULL, 0);
-- if (pid < 0)
-- return (int)pid;
-+ task = kthread_run(stt_timer_main, NULL, "st_timer");
-+ if (IS_ERR(task))
-+ return PTR_ERR(task);
-
- spin_lock(&stt_data.stt_lock);
- stt_data.stt_nthreads++;
-diff --git a/lnet/ulnds/socklnd/usocklnd.c b/lnet/ulnds/socklnd/usocklnd.c
-index cc8c4c8..d4d5027 100644
---- a/lnet/ulnds/socklnd/usocklnd.c
-+++ b/lnet/ulnds/socklnd/usocklnd.c
-@@ -296,14 +296,15 @@ usocklnd_base_startup()
- pthread_rwlock_init(&usock_data.ud_peers_lock, NULL);
-
- /* Spawn poll threads */
-- for (i = 0; i < usock_data.ud_npollthreads; i++) {
-- rc = cfs_create_thread(usocklnd_poll_thread,
-- &usock_data.ud_pollthreads[i], 0);
-- if (rc) {
-- usocklnd_base_shutdown(i);
-- return rc;
-- }
-- }
-+ for (i = 0; i < usock_data.ud_npollthreads; i++) {
-+ rc = PTR_ERR(kthread_run(usocklnd_poll_thread,
-+ &usock_data.ud_pollthreads[i],
-+ ""));
-+ if (IS_ERR_VALUE(rc)) {
-+ usocklnd_base_shutdown(i);
-+ return rc;
-+ }
-+ }
-
- usock_data.ud_state = UD_STATE_INITIALIZED;
-
-diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c
-index 88b51a9..517b8e3 100644
---- a/lustre/ldlm/ldlm_lib.c
-+++ b/lustre/ldlm/ldlm_lib.c
-@@ -1972,19 +1972,12 @@ static int target_recovery_thread(void *arg)
- struct ptlrpc_request *req;
- struct target_recovery_data *trd = &obd->obd_recovery_data;
- unsigned long delta;
-- unsigned long flags;
- struct lu_env *env;
- struct ptlrpc_thread *thread = NULL;
- int rc = 0;
- ENTRY;
-
-- cfs_daemonize_ctxt("tgt_recov");
--
-- SIGNAL_MASK_LOCK(current, flags);
-- sigfillset(¤t->blocked);
-- RECALC_SIGPENDING;
-- SIGNAL_MASK_UNLOCK(current, flags);
--
-+ unshare_fs_struct();
- OBD_ALLOC_PTR(thread);
- if (thread == NULL)
- RETURN(-ENOMEM);
-@@ -2109,22 +2102,24 @@ static int target_recovery_thread(void *arg)
- static int target_start_recovery_thread(struct lu_target *lut,
- svc_handler_t handler)
- {
-- struct obd_device *obd = lut->lut_obd;
-- int rc = 0;
-- struct target_recovery_data *trd = &obd->obd_recovery_data;
-+ struct obd_device *obd = lut->lut_obd;
-+ int rc = 0;
-+ struct target_recovery_data *trd = &obd->obd_recovery_data;
-
-- memset(trd, 0, sizeof(*trd));
-+ memset(trd, 0, sizeof(*trd));
- init_completion(&trd->trd_starting);
- init_completion(&trd->trd_finishing);
-- trd->trd_recovery_handler = handler;
-+ trd->trd_recovery_handler = handler;
-
-- if (cfs_create_thread(target_recovery_thread, lut, 0) > 0) {
-+ if (!IS_ERR(kthread_run(target_recovery_thread,
-+ lut, "tgt_recov"))) {
- wait_for_completion(&trd->trd_starting);
-- LASSERT(obd->obd_recovering != 0);
-- } else
-- rc = -ECHILD;
-+ LASSERT(obd->obd_recovering != 0);
-+ } else {
-+ rc = -ECHILD;
-+ }
-
-- return rc;
-+ return rc;
- }
-
- void target_stop_recovery_thread(struct obd_device *obd)
-diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c
-index 211380a..01fe1ca 100644
---- a/lustre/ldlm/ldlm_lockd.c
-+++ b/lustre/ldlm/ldlm_lockd.c
-@@ -178,7 +178,6 @@ static int expired_lock_main(void *arg)
- int do_dump;
-
- ENTRY;
-- cfs_daemonize("ldlm_elt");
-
- expired_lock_thread.elt_state = ELT_READY;
- cfs_waitq_signal(&expired_lock_thread.elt_waitq);
-@@ -2577,14 +2576,17 @@ static int ldlm_bl_thread_main(void *arg);
- static int ldlm_bl_thread_start(struct ldlm_bl_pool *blp)
- {
- struct ldlm_bl_thread_data bltd = { .bltd_blp = blp };
-- int rc;
-+ cfs_task_t *task;
-
- init_completion(&bltd.bltd_comp);
-- rc = cfs_create_thread(ldlm_bl_thread_main, &bltd, 0);
-- if (rc < 0) {
-- CERROR("cannot start LDLM thread ldlm_bl_%02d: rc %d\n",
-- cfs_atomic_read(&blp->blp_num_threads), rc);
-- return rc;
-+ bltd.bltd_num = cfs_atomic_read(&blp->blp_num_threads);
-+ snprintf(bltd.bltd_name, sizeof(bltd.bltd_name) - 1,
-+ "ldlm_bl_%02d", bltd.bltd_num);
-+ task = kthread_run(ldlm_bl_thread_main, &bltd, bltd.bltd_name);
-+ if (IS_ERR(task)) {
-+ CERROR("cannot start LDLM thread ldlm_bl_%02d: rc %ld\n",
-+ cfs_atomic_read(&blp->blp_num_threads), PTR_ERR(task));
-+ return PTR_ERR(task);
- }
- wait_for_completion(&bltd.bltd_comp);
-
-@@ -2608,14 +2610,9 @@ static int ldlm_bl_thread_main(void *arg)
-
- blp = bltd->bltd_blp;
-
-- bltd->bltd_num =
-- cfs_atomic_inc_return(&blp->blp_num_threads) - 1;
-+ cfs_atomic_inc(&blp->blp_num_threads);
- cfs_atomic_inc(&blp->blp_busy_threads);
-
-- snprintf(bltd->bltd_name, sizeof(bltd->bltd_name) - 1,
-- "ldlm_bl_%02d", bltd->bltd_num);
-- cfs_daemonize(bltd->bltd_name);
--
- complete(&bltd->bltd_comp);
- /* cannot use bltd after this, it is only on caller's stack */
- }
-@@ -2955,22 +2952,22 @@ static int ldlm_setup(void)
- }
-
- # ifdef HAVE_SERVER_SUPPORT
-- CFS_INIT_LIST_HEAD(&expired_lock_thread.elt_expired_locks);
-- expired_lock_thread.elt_state = ELT_STOPPED;
-- cfs_waitq_init(&expired_lock_thread.elt_waitq);
-+ CFS_INIT_LIST_HEAD(&expired_lock_thread.elt_expired_locks);
-+ expired_lock_thread.elt_state = ELT_STOPPED;
-+ cfs_waitq_init(&expired_lock_thread.elt_waitq);
-
-- CFS_INIT_LIST_HEAD(&waiting_locks_list);
-+ CFS_INIT_LIST_HEAD(&waiting_locks_list);
- spin_lock_init(&waiting_locks_spinlock);
-- cfs_timer_init(&waiting_locks_timer, waiting_locks_callback, 0);
-+ cfs_timer_init(&waiting_locks_timer, waiting_locks_callback, 0);
-
-- rc = cfs_create_thread(expired_lock_main, NULL, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(expired_lock_main, NULL, "ldlm_elt"));
-+ if (IS_ERR_VALUE(rc)) {
- CERROR("Cannot start ldlm expired-lock thread: %d\n", rc);
- GOTO(out, rc);
- }
-
-- cfs_wait_event(expired_lock_thread.elt_waitq,
-- expired_lock_thread.elt_state == ELT_READY);
-+ cfs_wait_event(expired_lock_thread.elt_waitq,
-+ expired_lock_thread.elt_state == ELT_READY);
- # endif /* HAVE_SERVER_SUPPORT */
-
- rc = ldlm_pools_init();
-diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c
-index d724a2d..fa14f66 100644
---- a/lustre/ldlm/ldlm_pool.c
-+++ b/lustre/ldlm/ldlm_pool.c
-@@ -1295,15 +1295,13 @@ EXPORT_SYMBOL(ldlm_pools_recalc);
- static int ldlm_pools_thread_main(void *arg)
- {
- struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
-- char *t_name = "ldlm_poold";
- ENTRY;
-
-- cfs_daemonize(t_name);
- thread_set_flags(thread, SVC_RUNNING);
- cfs_waitq_signal(&thread->t_ctl_waitq);
-
- CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
-- t_name, cfs_curproc_pid());
-+ "ldlm_poold", cfs_curproc_pid());
-
- while (1) {
- struct l_wait_info lwi;
-@@ -1335,43 +1333,38 @@ static int ldlm_pools_thread_main(void *arg)
- cfs_waitq_signal(&thread->t_ctl_waitq);
-
- CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
-- t_name, cfs_curproc_pid());
-+ "ldlm_poold", cfs_curproc_pid());
-
- complete_and_exit(&ldlm_pools_comp, 0);
- }
-
- static int ldlm_pools_thread_start(void)
- {
-- struct l_wait_info lwi = { 0 };
-- int rc;
-- ENTRY;
-+ struct l_wait_info lwi = { 0 };
-+ cfs_task_t *task;
-+ ENTRY;
-
-- if (ldlm_pools_thread != NULL)
-- RETURN(-EALREADY);
-+ if (ldlm_pools_thread != NULL)
-+ RETURN(-EALREADY);
-
-- OBD_ALLOC_PTR(ldlm_pools_thread);
-- if (ldlm_pools_thread == NULL)
-- RETURN(-ENOMEM);
-+ OBD_ALLOC_PTR(ldlm_pools_thread);
-+ if (ldlm_pools_thread == NULL)
-+ RETURN(-ENOMEM);
-
- init_completion(&ldlm_pools_comp);
-- cfs_waitq_init(&ldlm_pools_thread->t_ctl_waitq);
--
-- /*
-- * CLONE_VM and CLONE_FILES just avoid a needless copy, because we
-- * just drop the VM and FILES in cfs_daemonize() right away.
-- */
-- rc = cfs_create_thread(ldlm_pools_thread_main, ldlm_pools_thread,
-- CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- CERROR("Can't start pool thread, error %d\n",
-- rc);
-- OBD_FREE(ldlm_pools_thread, sizeof(*ldlm_pools_thread));
-- ldlm_pools_thread = NULL;
-- RETURN(rc);
-- }
-- l_wait_event(ldlm_pools_thread->t_ctl_waitq,
-- thread_is_running(ldlm_pools_thread), &lwi);
-- RETURN(0);
-+ cfs_waitq_init(&ldlm_pools_thread->t_ctl_waitq);
-+
-+ task = kthread_run(ldlm_pools_thread_main, ldlm_pools_thread,
-+ "ldlm_poold");
-+ if (IS_ERR(task)) {
-+ CERROR("Can't start pool thread, error %ld\n", PTR_ERR(task));
-+ OBD_FREE(ldlm_pools_thread, sizeof(*ldlm_pools_thread));
-+ ldlm_pools_thread = NULL;
-+ RETURN(PTR_ERR(task));
-+ }
-+ l_wait_event(ldlm_pools_thread->t_ctl_waitq,
-+ thread_is_running(ldlm_pools_thread), &lwi);
-+ RETURN(0);
- }
-
- static void ldlm_pools_thread_stop(void)
-diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c
-index 7ab686c..1d1cded 100644
---- a/lustre/llite/llite_capa.c
-+++ b/lustre/llite/llite_capa.c
-@@ -173,8 +173,6 @@ static int capa_thread_main(void *unused)
- int rc;
- ENTRY;
-
-- cfs_daemonize("ll_capa");
--
- thread_set_flags(&ll_capa_thread, SVC_RUNNING);
- cfs_waitq_signal(&ll_capa_thread.t_ctl_waitq);
-
-@@ -293,20 +291,21 @@ void ll_capa_timer_callback(unsigned long unused)
-
- int ll_capa_thread_start(void)
- {
-- int rc;
-- ENTRY;
-+ cfs_task_t *task;
-+ ENTRY;
-
-- cfs_waitq_init(&ll_capa_thread.t_ctl_waitq);
-+ cfs_waitq_init(&ll_capa_thread.t_ctl_waitq);
-
-- rc = cfs_create_thread(capa_thread_main, NULL, 0);
-- if (rc < 0) {
-- CERROR("cannot start expired capa thread: rc %d\n", rc);
-- RETURN(rc);
-- }
-- cfs_wait_event(ll_capa_thread.t_ctl_waitq,
-- thread_is_running(&ll_capa_thread));
-+ task = kthread_run(capa_thread_main, NULL, "ll_capa");
-+ if (IS_ERR(task)) {
-+ CERROR("cannot start expired capa thread: rc %ld\n",
-+ PTR_ERR(task));
-+ RETURN(PTR_ERR(task));
-+ }
-+ cfs_wait_event(ll_capa_thread.t_ctl_waitq,
-+ thread_is_running(&ll_capa_thread));
-
-- RETURN(0);
-+ RETURN(0);
- }
-
- void ll_capa_thread_stop(void)
-diff --git a/lustre/llite/llite_close.c b/lustre/llite/llite_close.c
-index 26a2c8c..f1a1415 100644
---- a/lustre/llite/llite_close.c
-+++ b/lustre/llite/llite_close.c
-@@ -349,12 +349,6 @@ static int ll_close_thread(void *arg)
- struct ll_close_queue *lcq = arg;
- ENTRY;
-
-- {
-- char name[CFS_CURPROC_COMM_MAX];
-- snprintf(name, sizeof(name) - 1, "ll_close");
-- cfs_daemonize(name);
-- }
--
- complete(&lcq->lcq_comp);
-
- while (1) {
-@@ -382,25 +376,25 @@ static int ll_close_thread(void *arg)
-
- int ll_close_thread_start(struct ll_close_queue **lcq_ret)
- {
-- struct ll_close_queue *lcq;
-- pid_t pid;
-+ struct ll_close_queue *lcq;
-+ cfs_task_t *task;
-
-- if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CLOSE_THREAD))
-- return -EINTR;
-+ if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CLOSE_THREAD))
-+ return -EINTR;
-
-- OBD_ALLOC(lcq, sizeof(*lcq));
-- if (lcq == NULL)
-- return -ENOMEM;
-+ OBD_ALLOC(lcq, sizeof(*lcq));
-+ if (lcq == NULL)
-+ return -ENOMEM;
-
- spin_lock_init(&lcq->lcq_lock);
- CFS_INIT_LIST_HEAD(&lcq->lcq_head);
- cfs_waitq_init(&lcq->lcq_waitq);
- init_completion(&lcq->lcq_comp);
-
-- pid = cfs_create_thread(ll_close_thread, lcq, 0);
-- if (pid < 0) {
-+ task = kthread_run(ll_close_thread, lcq, "ll_close");
-+ if (IS_ERR(task)) {
- OBD_FREE(lcq, sizeof(*lcq));
-- return pid;
-+ return PTR_ERR(task);
- }
-
- wait_for_completion(&lcq->lcq_comp);
-diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
-index f94a7ca..c494dd2 100644
---- a/lustre/llite/lloop.c
-+++ b/lustre/llite/lloop.c
-@@ -420,8 +420,6 @@ static int loop_thread(void *data)
- int refcheck;
- int ret = 0;
-
-- daemonize("lloop%d", lo->lo_number);
--
- set_user_nice(current, -20);
-
- lo->lo_state = LLOOP_BOUND;
-@@ -552,13 +550,13 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
- set_capacity(disks[lo->lo_number], size);
- bd_set_size(bdev, size << 9);
-
-- set_blocksize(bdev, lo->lo_blocksize);
-+ set_blocksize(bdev, lo->lo_blocksize);
-
-- cfs_create_thread(loop_thread, lo, CLONE_KERNEL);
-+ kthread_run(loop_thread, lo, "lloop%d", lo->lo_number);
- down(&lo->lo_sem);
-- return 0;
-+ return 0;
-
-- out:
-+out:
- /* This is safe: open() is still holding a reference. */
- cfs_module_put(THIS_MODULE);
- return error;
-diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c
-index a2e48f4..19ca1b4 100644
---- a/lustre/llite/statahead.c
-+++ b/lustre/llite/statahead.c
-@@ -981,12 +981,6 @@ static int ll_agl_thread(void *arg)
- struct l_wait_info lwi = { 0 };
- ENTRY;
-
-- {
-- char pname[16];
-- snprintf(pname, 15, "ll_agl_%u", plli->lli_opendir_pid);
-- cfs_daemonize(pname);
-- }
--
- CDEBUG(D_READA, "agl thread started: [pid %d] [parent %.*s]\n",
- cfs_curproc_pid(), parent->d_name.len, parent->d_name.name);
-
-@@ -1040,25 +1034,28 @@ static int ll_agl_thread(void *arg)
-
- static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
- {
-- struct ptlrpc_thread *thread = &sai->sai_agl_thread;
-- struct l_wait_info lwi = { 0 };
-- int rc;
-- ENTRY;
-+ struct ptlrpc_thread *thread = &sai->sai_agl_thread;
-+ struct l_wait_info lwi = { 0 };
-+ struct ll_inode_info *plli;
-+ cfs_task_t *task;
-+ ENTRY;
-
-- CDEBUG(D_READA, "start agl thread: [pid %d] [parent %.*s]\n",
-- cfs_curproc_pid(), parent->d_name.len, parent->d_name.name);
-+ CDEBUG(D_READA, "start agl thread: [pid %d] [parent %.*s]\n",
-+ cfs_curproc_pid(), parent->d_name.len, parent->d_name.name);
-
-- rc = cfs_create_thread(ll_agl_thread, parent, 0);
-- if (rc < 0) {
-- CERROR("can't start ll_agl thread, rc: %d\n", rc);
-- thread_set_flags(thread, SVC_STOPPED);
-- RETURN_EXIT;
-- }
-+ plli = ll_i2info(parent->d_inode);
-+ task = kthread_run(ll_agl_thread, parent,
-+ "ll_agl_%u", plli->lli_opendir_pid);
-+ if (IS_ERR(task)) {
-+ CERROR("can't start ll_agl thread, rc: %ld\n", PTR_ERR(task));
-+ thread_set_flags(thread, SVC_STOPPED);
-+ RETURN_EXIT;
-+ }
-
-- l_wait_event(thread->t_ctl_waitq,
-- thread_is_running(thread) || thread_is_stopped(thread),
-- &lwi);
-- EXIT;
-+ l_wait_event(thread->t_ctl_waitq,
-+ thread_is_running(thread) || thread_is_stopped(thread),
-+ &lwi);
-+ EXIT;
- }
-
- static int ll_statahead_thread(void *arg)
-@@ -1079,12 +1076,6 @@ static int ll_statahead_thread(void *arg)
- struct l_wait_info lwi = { 0 };
- ENTRY;
-
-- {
-- char pname[16];
-- snprintf(pname, 15, "ll_sa_%u", plli->lli_opendir_pid);
-- cfs_daemonize(pname);
-- }
--
- CDEBUG(D_READA, "statahead thread started: [pid %d] [parent %.*s]\n",
- cfs_curproc_pid(), parent->d_name.len, parent->d_name.name);
-
-@@ -1548,6 +1539,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
- struct ptlrpc_thread *thread;
- struct l_wait_info lwi = { 0 };
- int rc = 0;
-+ struct ll_inode_info *plli;
- ENTRY;
-
- LASSERT(lli->lli_opendir_pid == cfs_curproc_pid());
-@@ -1693,11 +1685,14 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
- cfs_curproc_pid(), parent->d_name.len, parent->d_name.name);
-
- lli->lli_sai = sai;
-- rc = cfs_create_thread(ll_statahead_thread, parent, 0);
-- thread = &sai->sai_thread;
-- if (rc < 0) {
-- CERROR("can't start ll_sa thread, rc: %d\n", rc);
-- dput(parent);
-+
-+ plli = ll_i2info(parent->d_inode);
-+ rc = PTR_ERR(kthread_run(ll_statahead_thread, parent,
-+ "ll_sa_%u", plli->lli_opendir_pid));
-+ thread = &sai->sai_thread;
-+ if (IS_ERR_VALUE(rc)) {
-+ CERROR("can't start ll_sa thread, rc: %d\n", rc);
-+ dput(parent);
- lli->lli_opendir_key = NULL;
- thread_set_flags(thread, SVC_STOPPED);
- thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED);
-diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
-index 5751460..2581b69 100644
---- a/lustre/mdc/mdc_request.c
-+++ b/lustre/mdc/mdc_request.c
-@@ -1571,13 +1571,6 @@ static int mdc_changelog_send_thread(void *csdata)
- CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n",
- cs->cs_fp, cs->cs_startrec);
-
-- /*
-- * It's important to daemonize here to close unused FDs.
-- * The write fd from pipe is already opened by the caller,
-- * so it's fine to clear all files here
-- */
-- cfs_daemonize("mdc_clg_send_thread");
--
- OBD_ALLOC(cs->cs_buf, CR_MAXSIZE);
- if (cs->cs_buf == NULL)
- GOTO(out, rc = -ENOMEM);
-@@ -1614,12 +1607,10 @@ out:
- llog_cat_close(NULL, llh);
- if (ctxt)
- llog_ctxt_put(ctxt);
-- if (cs->cs_buf)
-- OBD_FREE(cs->cs_buf, CR_MAXSIZE);
-- OBD_FREE_PTR(cs);
-- /* detach from parent process so we get cleaned up */
-- cfs_daemonize("cl_send");
-- return rc;
-+ if (cs->cs_buf)
-+ OBD_FREE(cs->cs_buf, CR_MAXSIZE);
-+ OBD_FREE_PTR(cs);
-+ return rc;
- }
-
- static int mdc_ioc_changelog_send(struct obd_device *obd,
-@@ -1639,13 +1630,16 @@ static int mdc_ioc_changelog_send(struct obd_device *obd,
- cs->cs_fp = fget(icc->icc_id);
- cs->cs_flags = icc->icc_flags;
-
-- /* New thread because we should return to user app before
-- writing into our pipe */
-- rc = cfs_create_thread(mdc_changelog_send_thread, cs, CFS_DAEMON_FLAGS);
-- if (rc >= 0) {
-- CDEBUG(D_CHANGELOG, "start changelog thread: %d\n", rc);
-- return 0;
-- }
-+ /*
-+ * New thread because we should return to user app before
-+ * writing into our pipe
-+ */
-+ rc = PTR_ERR(kthread_run(mdc_changelog_send_thread, cs,
-+ "mdc_clg_send_thread"));
-+ if (!IS_ERR_VALUE(rc)) {
-+ CDEBUG(D_CHANGELOG, "start changelog thread\n");
-+ return 0;
-+ }
-
- CERROR("Failed to start changelog thread: %d\n", rc);
- OBD_FREE_PTR(cs);
-diff --git a/lustre/mdd/mdd_lfsck.c b/lustre/mdd/mdd_lfsck.c
-index 7ab15f9..6d6208b 100644
---- a/lustre/mdd/mdd_lfsck.c
-+++ b/lustre/mdd/mdd_lfsck.c
-@@ -2533,8 +2533,7 @@ static int mdd_lfsck_main(void *args)
- int rc;
- ENTRY;
-
-- cfs_daemonize("lfsck");
-- rc = lu_env_init(&env, LCT_MD_THREAD | LCT_DT_THREAD);
-+ rc = lu_env_init(&env, LCT_MD_THREAD);
- if (rc != 0) {
- CERROR("%s: LFSCK, fail to init env, rc = %d\n",
- mdd_lfsck2name(lfsck), rc);
-@@ -2798,8 +2797,8 @@ trigger:
-
- lfsck->ml_args_oit = (flags << DT_OTABLE_IT_FLAGS_SHIFT) | valid;
- thread_set_flags(thread, 0);
-- rc = cfs_create_thread(mdd_lfsck_main, lfsck, 0);
-- if (rc < 0)
-+ rc = PTR_ERR(kthread_run(mdd_lfsck_main, lfsck, "lfsck"));
-+ if (IS_ERR_VALUE(rc))
- CERROR("%s: cannot start LFSCK thread, rc = %d\n",
- mdd_lfsck2name(lfsck), rc);
- else
-diff --git a/lustre/mdt/mdt_capa.c b/lustre/mdt/mdt_capa.c
-index 567a0f8..6e13b42 100644
---- a/lustre/mdt/mdt_capa.c
-+++ b/lustre/mdt/mdt_capa.c
-@@ -218,7 +218,7 @@ static int mdt_ck_thread_main(void *args)
- int rc;
- ENTRY;
-
-- cfs_daemonize_ctxt("mdt_ck");
-+ unshare_fs_struct();
- cfs_block_allsigs();
-
- thread_set_flags(thread, SVC_RUNNING);
-@@ -290,18 +290,18 @@ static int mdt_ck_thread_main(void *args)
-
- int mdt_ck_thread_start(struct mdt_device *mdt)
- {
-- struct ptlrpc_thread *thread = &mdt->mdt_ck_thread;
-- int rc;
--
-- cfs_waitq_init(&thread->t_ctl_waitq);
-- rc = cfs_create_thread(mdt_ck_thread_main, mdt, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- CERROR("cannot start mdt_ck thread, rc = %d\n", rc);
-- return rc;
-- }
--
-- l_wait_condition(thread->t_ctl_waitq, thread_is_running(thread));
-- return 0;
-+ struct ptlrpc_thread *thread = &mdt->mdt_ck_thread;
-+ cfs_task_t *task;
-+
-+ cfs_waitq_init(&thread->t_ctl_waitq);
-+ task = kthread_run(mdt_ck_thread_main, mdt, "mdt_ck");
-+ if (IS_ERR(task)) {
-+ CERROR("cannot start mdt_ck thread, rc = %ld\n", PTR_ERR(task));
-+ return PTR_ERR(task);
-+ }
-+
-+ l_wait_condition(thread->t_ctl_waitq, thread_is_running(thread));
-+ return 0;
- }
-
- void mdt_ck_thread_stop(struct mdt_device *mdt)
-diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
-index 83bd75e..b7dccf0 100644
---- a/lustre/mgc/mgc_request.c
-+++ b/lustre/mgc/mgc_request.c
-@@ -480,12 +480,9 @@ static void do_requeue(struct config_llog_data *cld)
-
- static int mgc_requeue_thread(void *data)
- {
-- char name[] = "ll_cfg_requeue";
- int rc = 0;
- ENTRY;
-
-- cfs_daemonize(name);
--
- CDEBUG(D_MGC, "Starting requeue thread\n");
-
- /* Keep trying failed locks periodically */
-@@ -776,20 +773,20 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
- sptlrpc_lprocfs_cliobd_attach(obd);
-
- if (cfs_atomic_inc_return(&mgc_count) == 1) {
-- rq_state = 0;
-- cfs_waitq_init(&rq_waitq);
--
-- /* start requeue thread */
-- rc = cfs_create_thread(mgc_requeue_thread, NULL,
-- CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- CERROR("%s: Cannot start requeue thread (%d),"
-- "no more log updates!\n",
-- obd->obd_name, rc);
-- GOTO(err_cleanup, rc);
-- }
-- /* rc is the pid of mgc_requeue_thread. */
-- rc = 0;
-+ rq_state = 0;
-+ cfs_waitq_init(&rq_waitq);
-+
-+ /* start requeue thread */
-+ rc = PTR_ERR(kthread_run(mgc_requeue_thread, NULL,
-+ "ll_cfg_requeue"));
-+ if (IS_ERR_VALUE(rc)) {
-+ CERROR("%s: Cannot start requeue thread (%d),"
-+ "no more log updates!\n",
-+ obd->obd_name, rc);
-+ GOTO(err_cleanup, rc);
-+ }
-+ /* rc is the task_struct pointer of mgc_requeue_thread. */
-+ rc = 0;
- }
-
- RETURN(rc);
-diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c
-index 781250f..e6abdc4 100644
---- a/lustre/mgs/mgs_nids.c
-+++ b/lustre/mgs/mgs_nids.c
-@@ -440,7 +440,6 @@ static int mgs_ir_notify(void *arg)
-
- LASSERTF(sizeof(name) < 32, "name is too large to be in stack.\n");
- sprintf(name, "mgs_%s_notify", fsdb->fsdb_name);
-- cfs_daemonize(name);
-
- complete(&fsdb->fsdb_notify_comp);
-
-@@ -471,7 +470,7 @@ static int mgs_ir_notify(void *arg)
- int mgs_ir_init_fs(const struct lu_env *env, struct mgs_device *mgs,
- struct fs_db *fsdb)
- {
-- int rc;
-+ cfs_task_t *task;
-
- if (!ir_timeout)
- ir_timeout = OBD_IR_MGS_TIMEOUT;
-@@ -488,11 +487,13 @@ int mgs_ir_init_fs(const struct lu_env *env, struct mgs_device *mgs,
- cfs_atomic_set(&fsdb->fsdb_notify_phase, 0);
- cfs_waitq_init(&fsdb->fsdb_notify_waitq);
- init_completion(&fsdb->fsdb_notify_comp);
-- rc = cfs_create_thread(mgs_ir_notify, fsdb, CFS_DAEMON_FLAGS);
-- if (rc > 0)
-+
-+ task = kthread_run(mgs_ir_notify, fsdb,
-+ "mgs_%s_notify", fsdb->fsdb_name);
-+ if (IS_ERR(task))
- wait_for_completion(&fsdb->fsdb_notify_comp);
-- else
-- CERROR("Start notify thread error %d\n", rc);
-+ else
-+ CERROR("Start notify thread error %ld\n", PTR_ERR(task));
-
- mgs_nidtbl_init_fs(env, fsdb);
- return 0;
-diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
-index e09f15e..6900bbc 100644
---- a/lustre/obdclass/genops.c
-+++ b/lustre/obdclass/genops.c
-@@ -1744,14 +1744,7 @@ EXPORT_SYMBOL(obd_zombie_barrier);
- */
- static int obd_zombie_impexp_thread(void *unused)
- {
-- int rc;
--
-- rc = cfs_daemonize_ctxt("obd_zombid");
-- if (rc != 0) {
-- complete(&obd_zombie_start);
-- RETURN(rc);
-- }
--
-+ unshare_fs_struct();
- complete(&obd_zombie_start);
-
- obd_zombie_pid = cfs_curproc_pid();
-@@ -1800,7 +1793,9 @@ int obd_zombie_impexp_kill(void *arg)
- */
- int obd_zombie_impexp_init(void)
- {
-- int rc;
-+#ifdef __KERNEL__
-+ cfs_task_t *task;
-+#endif
-
- CFS_INIT_LIST_HEAD(&obd_zombie_imports);
- CFS_INIT_LIST_HEAD(&obd_zombie_exports);
-@@ -1811,9 +1806,9 @@ int obd_zombie_impexp_init(void)
- obd_zombie_pid = 0;
-
- #ifdef __KERNEL__
-- rc = cfs_create_thread(obd_zombie_impexp_thread, NULL, 0);
-- if (rc < 0)
-- RETURN(rc);
-+ task = kthread_run(obd_zombie_impexp_thread, NULL, "obd_zombid");
-+ if (IS_ERR(task))
-+ RETURN(PTR_ERR(task));
-
- wait_for_completion(&obd_zombie_start);
- #else
-@@ -1825,9 +1820,8 @@ int obd_zombie_impexp_init(void)
- obd_zombie_impexp_idle_cb =
- liblustre_register_idle_callback("obd_zombi_impexp_check",
- &obd_zombie_impexp_check, NULL);
-- rc = 0;
- #endif
-- RETURN(rc);
-+ RETURN(0);
- }
- /**
- * stop destroy zombie import/export thread
-diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c
-index 2ab3061..2cd9598 100644
---- a/lustre/obdclass/llog.c
-+++ b/lustre/obdclass/llog.c
-@@ -438,7 +438,7 @@ static int llog_process_thread_daemonize(void *arg)
- struct lu_env env;
- int rc;
-
-- cfs_daemonize_ctxt("llog_process_thread");
-+ unshare_fs_struct();
-
- /* client env has no keys, tags is just 0 */
- rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
-@@ -480,9 +480,9 @@ int llog_process_or_fork(const struct lu_env *env,
- * init the new one in llog_process_thread_daemonize. */
- lpi->lpi_env = NULL;
- init_completion(&lpi->lpi_completion);
-- rc = cfs_create_thread(llog_process_thread_daemonize, lpi,
-- CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(llog_process_thread_daemonize, lpi,
-+ "llog_process_thread"));
-+ if (IS_ERR_VALUE(rc)) {
- CERROR("%s: cannot start thread: rc = %d\n",
- loghandle->lgh_ctxt->loc_obd->obd_name, rc);
- OBD_FREE_PTR(lpi);
-diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
-index 6e9c37b..f0ad81d 100644
---- a/lustre/osd-ldiskfs/osd_scrub.c
-+++ b/lustre/osd-ldiskfs/osd_scrub.c
-@@ -1027,7 +1027,6 @@ static int osd_scrub_main(void *args)
- int rc;
- ENTRY;
-
-- cfs_daemonize("OI_scrub");
- rc = lu_env_init(&env, LCT_DT_THREAD);
- if (rc != 0) {
- CERROR("%.16s: OI scrub, fail to init env, rc = %d\n",
-@@ -1601,8 +1600,8 @@ again:
-
- scrub->os_start_flags = flags;
- thread_set_flags(thread, 0);
-- rc = cfs_create_thread(osd_scrub_main, dev, 0);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(osd_scrub_main, dev, "OI_scrub"));
-+ if (IS_ERR_VALUE(rc)) {
- CERROR("%.16s: cannot start iteration thread, rc = %d\n",
- LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name, rc);
- RETURN(rc);
-diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c
-index 073bd4b..227a6ef 100644
---- a/lustre/osp/osp_precreate.c
-+++ b/lustre/osp/osp_precreate.c
-@@ -872,15 +872,11 @@ static int osp_precreate_thread(void *_arg)
- struct osp_device *d = _arg;
- struct ptlrpc_thread *thread = &d->opd_pre_thread;
- struct l_wait_info lwi = { 0 };
-- char pname[16];
- struct lu_env env;
- int rc;
-
- ENTRY;
-
-- sprintf(pname, "osp-pre-%u", d->opd_index);
-- cfs_daemonize(pname);
--
- rc = lu_env_init(&env, d->opd_dt_dev.dd_lu_dev.ld_type->ldt_ctx_tags);
- if (rc) {
- CERROR("%s: init env error: rc = %d\n", d->opd_obd->obd_name,
-@@ -1239,7 +1235,7 @@ out:
- int osp_init_precreate(struct osp_device *d)
- {
- struct l_wait_info lwi = { 0 };
-- int rc;
-+ cfs_task_t *task;
-
- ENTRY;
-
-@@ -1274,10 +1270,11 @@ int osp_init_precreate(struct osp_device *d)
- /*
- * start thread handling precreation and statfs updates
- */
-- rc = cfs_create_thread(osp_precreate_thread, d, 0);
-- if (rc < 0) {
-- CERROR("can't start precreate thread %d\n", rc);
-- RETURN(rc);
-+ task = kthread_run(osp_precreate_thread, d,
-+ "osp-pre-%u", d->opd_index);
-+ if (IS_ERR(task)) {
-+ CERROR("can't start precreate thread %ld\n", PTR_ERR(task));
-+ RETURN(PTR_ERR(task));
- }
-
- l_wait_event(d->opd_pre_thread.t_ctl_waitq,
-diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c
-index c845077..852f1ee 100644
---- a/lustre/osp/osp_sync.c
-+++ b/lustre/osp/osp_sync.c
-@@ -823,7 +823,6 @@ static int osp_sync_thread(void *_arg)
- struct llog_handle *llh;
- struct lu_env env;
- int rc, count;
-- char pname[16];
-
- ENTRY;
-
-@@ -834,9 +833,6 @@ static int osp_sync_thread(void *_arg)
- RETURN(rc);
- }
-
-- sprintf(pname, "osp-syn-%u", d->opd_index);
-- cfs_daemonize(pname);
--
- spin_lock(&d->opd_syn_lock);
- thread->t_flags = SVC_RUNNING;
- spin_unlock(&d->opd_syn_lock);
-@@ -1041,8 +1037,9 @@ int osp_sync_init(const struct lu_env *env, struct osp_device *d)
- cfs_waitq_init(&d->opd_syn_thread.t_ctl_waitq);
- CFS_INIT_LIST_HEAD(&d->opd_syn_committed_there);
-
-- rc = cfs_create_thread(osp_sync_thread, d, 0);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(osp_sync_thread, d,
-+ "osp-syn-%u", d->opd_index));
-+ if (IS_ERR_VALUE(rc)) {
- CERROR("%s: can't start sync thread: rc = %d\n",
- d->opd_obd->obd_name, rc);
- GOTO(err_llog, rc);
-diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c
-index 6ab0248..0eb47d9 100644
---- a/lustre/ptlrpc/import.c
-+++ b/lustre/ptlrpc/import.c
-@@ -1267,7 +1267,7 @@ static int ptlrpc_invalidate_import_thread(void *data)
-
- ENTRY;
-
-- cfs_daemonize_ctxt("ll_imp_inval");
-+ unshare_fs_struct();
-
- CDEBUG(D_HA, "thread invalidate import %s to %s@%s\n",
- imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
-@@ -1337,20 +1337,24 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
- spin_unlock(&imp->imp_lock);
-
- #ifdef __KERNEL__
-- /* bug 17802: XXX client_disconnect_export vs connect request
-- * race. if client will evicted at this time, we start
-- * invalidate thread without reference to import and import can
-- * be freed at same time. */
-- class_import_get(imp);
-- rc = cfs_create_thread(ptlrpc_invalidate_import_thread, imp,
-- CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- class_import_put(imp);
-- CERROR("error starting invalidate thread: %d\n", rc);
-- } else {
-- rc = 0;
-- }
-- RETURN(rc);
-+ {
-+ cfs_task_t *task;
-+ /* bug 17802: XXX client_disconnect_export vs connect request
-+ * race. if client will evicted at this time, we start
-+ * invalidate thread without reference to import and import can
-+ * be freed at same time. */
-+ class_import_get(imp);
-+ task = kthread_run(ptlrpc_invalidate_import_thread, imp,
-+ "ll_imp_inval");
-+ if (IS_ERR(task)) {
-+ class_import_put(imp);
-+ CERROR("error starting invalidate thread: %d\n", rc);
-+ rc = PTR_ERR(task);
-+ } else {
-+ rc = 0;
-+ }
-+ RETURN(rc);
-+ }
- #else
- ptlrpc_invalidate_import(imp);
-
-diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c
-index b42fb10..4c4ba01 100644
---- a/lustre/ptlrpc/pinger.c
-+++ b/lustre/ptlrpc/pinger.c
-@@ -306,8 +306,6 @@ static int ptlrpc_pinger_main(void *arg)
- struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
- ENTRY;
-
-- cfs_daemonize(thread->t_name);
--
- /* Record that the thread is running */
- thread_set_flags(thread, SVC_RUNNING);
- cfs_waitq_signal(&thread->t_ctl_waitq);
-@@ -402,14 +400,14 @@ int ptlrpc_start_pinger(void)
-
- /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we
- * just drop the VM and FILES in cfs_daemonize_ctxt() right away. */
-- rc = cfs_create_thread(ptlrpc_pinger_main,
-- pinger_thread, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- CERROR("cannot start thread: %d\n", rc);
-- OBD_FREE(pinger_thread, sizeof(*pinger_thread));
-- pinger_thread = NULL;
-- RETURN(rc);
-- }
-+ rc = PTR_ERR(kthread_run(ptlrpc_pinger_main,
-+ pinger_thread, pinger_thread->t_name));
-+ if (IS_ERR_VALUE(rc)) {
-+ CERROR("cannot start thread: %d\n", rc);
-+ OBD_FREE(pinger_thread, sizeof(*pinger_thread));
-+ pinger_thread = NULL;
-+ RETURN(rc);
-+ }
- l_wait_event(pinger_thread->t_ctl_waitq,
- thread_is_running(pinger_thread), &lwi);
-
-@@ -678,7 +676,7 @@ static int ping_evictor_main(void *arg)
- time_t expire_time;
- ENTRY;
-
-- cfs_daemonize_ctxt("ll_evictor");
-+ unshare_fs_struct();
-
- CDEBUG(D_HA, "Starting Ping Evictor\n");
- pet_state = PET_READY;
-@@ -753,18 +751,19 @@ static int ping_evictor_main(void *arg)
-
- void ping_evictor_start(void)
- {
-- int rc;
-+ cfs_task_t *task;
-
-- if (++pet_refcount > 1)
-- return;
-+ if (++pet_refcount > 1)
-+ return;
-
-- cfs_waitq_init(&pet_waitq);
-+ cfs_waitq_init(&pet_waitq);
-
-- rc = cfs_create_thread(ping_evictor_main, NULL, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- pet_refcount--;
-- CERROR("Cannot start ping evictor thread: %d\n", rc);
-- }
-+ task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
-+ if (IS_ERR(task)) {
-+ pet_refcount--;
-+ CERROR("Cannot start ping evictor thread: %ld\n",
-+ PTR_ERR(task));
-+ }
- }
- EXPORT_SYMBOL(ping_evictor_start);
-
-diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c
-index 669b0d7..b6486e0 100644
---- a/lustre/ptlrpc/ptlrpcd.c
-+++ b/lustre/ptlrpc/ptlrpcd.c
-@@ -410,7 +410,7 @@ static int ptlrpcd(void *arg)
- int rc, exit = 0;
- ENTRY;
-
-- cfs_daemonize_ctxt(pc->pc_name);
-+ unshare_fs_struct();
- #if defined(CONFIG_SMP) && \
- (defined(HAVE_CPUMASK_OF_NODE) || defined(HAVE_NODE_TO_CPUMASK))
- if (test_bit(LIOD_BIND, &pc->pc_flags)) {
-@@ -709,18 +709,21 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc)
-
- env = 1;
- #ifdef __KERNEL__
-- if (index >= 0) {
-- rc = ptlrpcd_bind(index, max);
-- if (rc < 0)
-- GOTO(out, rc);
-- }
-+ {
-+ cfs_task_t *task;
-+ if (index >= 0) {
-+ rc = ptlrpcd_bind(index, max);
-+ if (rc < 0)
-+ GOTO(out, rc);
-+ }
-
-- rc = cfs_create_thread(ptlrpcd, pc, 0);
-- if (rc < 0)
-- GOTO(out, rc);
-+ task = kthread_run(ptlrpcd, pc, pc->pc_name);
-+ if (IS_ERR(task))
-+ GOTO(out, rc = PTR_ERR(task));
-
-- rc = 0;
-- wait_for_completion(&pc->pc_starting);
-+ rc = 0;
-+ wait_for_completion(&pc->pc_starting);
-+ }
- #else
- pc->pc_wait_callback =
- liblustre_register_wait_callback("ptlrpcd_check_async_rpcs",
-diff --git a/lustre/ptlrpc/sec_gc.c b/lustre/ptlrpc/sec_gc.c
-index 40f16eb..4c6f20d 100644
---- a/lustre/ptlrpc/sec_gc.c
-+++ b/lustre/ptlrpc/sec_gc.c
-@@ -169,7 +169,7 @@ static int sec_gc_main(void *arg)
- struct ptlrpc_thread *thread = (struct ptlrpc_thread *) arg;
- struct l_wait_info lwi;
-
-- cfs_daemonize_ctxt("sptlrpc_gc");
-+ unshare_fs_struct();
-
- /* Record that the thread is running */
- thread_set_flags(thread, SVC_RUNNING);
-@@ -222,7 +222,7 @@ again:
- int sptlrpc_gc_init(void)
- {
- struct l_wait_info lwi = { 0 };
-- int rc;
-+ cfs_task_t *task;
-
- mutex_init(&sec_gc_mutex);
- spin_lock_init(&sec_gc_list_lock);
-@@ -232,10 +232,10 @@ int sptlrpc_gc_init(void)
- memset(&sec_gc_thread, 0, sizeof(sec_gc_thread));
- cfs_waitq_init(&sec_gc_thread.t_ctl_waitq);
-
-- rc = cfs_create_thread(sec_gc_main, &sec_gc_thread, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-- CERROR("can't start gc thread: %d\n", rc);
-- return rc;
-+ task = kthread_run(sec_gc_main, &sec_gc_thread, "sptlrpc_gc");
-+ if (IS_ERR(task)) {
-+ CERROR("can't start gc thread: %ld\n", PTR_ERR(task));
-+ return PTR_ERR(task);
- }
-
- l_wait_event(sec_gc_thread.t_ctl_waitq,
-diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c
-index 7e176c0..c1e23fd 100644
---- a/lustre/ptlrpc/service.c
-+++ b/lustre/ptlrpc/service.c
-@@ -2400,7 +2400,7 @@ static int ptlrpc_main(void *arg)
- ENTRY;
-
- thread->t_pid = cfs_curproc_pid();
-- cfs_daemonize_ctxt(thread->t_name);
-+ unshare_fs_struct();
-
- /* NB: we will call cfs_cpt_bind() for all threads, because we
- * might want to run lustre server only on a subset of system CPUs,
-@@ -2599,7 +2599,7 @@ static int ptlrpc_hr_main(void *arg)
-
- snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d",
- hrp->hrp_cpt, hrt->hrt_id);
-- cfs_daemonize_ctxt(threadname);
-+ unshare_fs_struct();
-
- rc = cfs_cpt_bind(ptlrpc_hr.hr_cpt_table, hrp->hrp_cpt);
- if (rc != 0) {
-@@ -2665,15 +2665,18 @@ static int ptlrpc_start_hr_threads(void)
- int rc = 0;
-
- for (j = 0; j < hrp->hrp_nthrs; j++) {
-- rc = cfs_create_thread(ptlrpc_hr_main,
-- &hrp->hrp_thrs[j],
-- CLONE_VM | CLONE_FILES);
-- if (rc < 0)
-+ struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
-+ rc = PTR_ERR(kthread_run(ptlrpc_hr_main,
-+ &hrp->hrp_thrs[j],
-+ "ptlrpc_hr%02d_%03d",
-+ hrp->hrp_cpt,
-+ hrt->hrt_id));
-+ if (IS_ERR_VALUE(rc))
- break;
- }
- cfs_wait_event(ptlrpc_hr.hr_waitq,
- cfs_atomic_read(&hrp->hrp_nstarted) == j);
-- if (rc >= 0)
-+ if (!IS_ERR_VALUE(rc))
- continue;
-
- CERROR("Reply handling thread %d:%d Failed on starting: "
-@@ -2856,12 +2859,8 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
- }
-
- CDEBUG(D_RPCTRACE, "starting thread '%s'\n", thread->t_name);
-- /*
-- * CLONE_VM and CLONE_FILES just avoid a needless copy, because we
-- * just drop the VM and FILES in cfs_daemonize_ctxt() right away.
-- */
-- rc = cfs_create_thread(ptlrpc_main, thread, CFS_DAEMON_FLAGS);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(ptlrpc_main, thread, thread->t_name));
-+ if (IS_ERR_VALUE(rc)) {
- CERROR("cannot start thread '%s': rc %d\n",
- thread->t_name, rc);
- spin_lock(&svcpt->scp_lock);
-diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c
-index 9339580..1f33aef 100644
---- a/lustre/quota/qmt_lock.c
-+++ b/lustre/quota/qmt_lock.c
-@@ -716,7 +716,6 @@ static int qmt_reba_thread(void *arg)
- struct l_wait_info lwi = { 0 };
- struct lu_env *env;
- struct lquota_entry *lqe, *tmp;
-- char pname[MTI_NAME_MAXLEN];
- int rc;
- ENTRY;
-
-@@ -731,9 +730,6 @@ static int qmt_reba_thread(void *arg)
- RETURN(rc);
- }
-
-- snprintf(pname, MTI_NAME_MAXLEN, "qmt_reba_%s", qmt->qmt_svname);
-- cfs_daemonize(pname);
--
- thread_set_flags(thread, SVC_RUNNING);
- cfs_waitq_signal(&thread->t_ctl_waitq);
-
-@@ -773,15 +769,16 @@ int qmt_start_reba_thread(struct qmt_device *qmt)
- {
- struct ptlrpc_thread *thread = &qmt->qmt_reba_thread;
- struct l_wait_info lwi = { 0 };
-- int rc;
-+ cfs_task_t *task;
- ENTRY;
-
-- rc = cfs_create_thread(qmt_reba_thread, (void *)qmt, 0);
-- if (rc < 0) {
-- CERROR("%s: failed to start rebalance thread (%d)\n",
-- qmt->qmt_svname, rc);
-+ task = kthread_run(qmt_reba_thread, (void *)qmt,
-+ "qmt_reba_%s", qmt->qmt_svname);
-+ if (IS_ERR(task)) {
-+ CERROR("%s: failed to start rebalance thread (%ld)\n",
-+ qmt->qmt_svname, PTR_ERR(task));
- thread_set_flags(thread, SVC_STOPPED);
-- RETURN(rc);
-+ RETURN(PTR_ERR(task));
- }
-
- l_wait_event(thread->t_ctl_waitq,
-diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c
-index 0e0643f..6fec9e6 100644
---- a/lustre/quota/qsd_reint.c
-+++ b/lustre/quota/qsd_reint.c
-@@ -417,8 +417,6 @@ static int qsd_reint_main(void *args)
- int rc;
- ENTRY;
-
-- cfs_daemonize("qsd_reint");
--
- CDEBUG(D_QUOTA, "%s: Starting reintegration thread for "DFID"\n",
- qsd->qsd_svname, PFID(&qqi->qqi_fid));
-
-@@ -662,8 +660,8 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi)
- RETURN(0);
- }
-
-- rc = cfs_create_thread(qsd_reint_main, (void *)qqi, 0);
-- if (rc < 0) {
-+ rc = PTR_ERR(kthread_run(qsd_reint_main, (void *)qqi, "qsd_reint"));
-+ if (IS_ERR_VALUE(rc)) {
- thread_set_flags(thread, SVC_STOPPED);
- write_lock(&qsd->qsd_lock);
- qqi->qqi_reint = 0;
-diff --git a/lustre/quota/qsd_writeback.c b/lustre/quota/qsd_writeback.c
-index fdc1ef5..f9af987 100644
---- a/lustre/quota/qsd_writeback.c
-+++ b/lustre/quota/qsd_writeback.c
-@@ -404,7 +404,6 @@ static int qsd_upd_thread(void *arg)
- struct l_wait_info lwi;
- cfs_list_t queue;
- struct qsd_upd_rec *upd, *n;
-- char pname[MTI_NAME_MAXLEN];
- struct lu_env *env;
- int qtype, rc = 0;
- bool uptodate;
-@@ -423,9 +422,6 @@ static int qsd_upd_thread(void *arg)
- RETURN(rc);
- }
-
-- snprintf(pname, MTI_NAME_MAXLEN, "lquota_wb_%s", qsd->qsd_svname);
-- cfs_daemonize(pname);
--
- thread_set_flags(thread, SVC_RUNNING);
- cfs_waitq_signal(&thread->t_ctl_waitq);
-
-@@ -487,14 +483,16 @@ int qsd_start_upd_thread(struct qsd_instance *qsd)
- {
- struct ptlrpc_thread *thread = &qsd->qsd_upd_thread;
- struct l_wait_info lwi = { 0 };
-- int rc;
-+ cfs_task_t *task;
- ENTRY;
-
-- rc = cfs_create_thread(qsd_upd_thread, (void *)qsd, 0);
-- if (rc < 0) {
-- CERROR("Fail to start quota update thread. rc: %d\n", rc);
-+ task = kthread_run(qsd_upd_thread, (void *)qsd,
-+ "lquota_wb_%s", qsd->qsd_svname);
-+ if (IS_ERR(task)) {
-+ CERROR("Fail to start quota update thread. rc: %ld\n",
-+ PTR_ERR(task));
- thread_set_flags(thread, SVC_STOPPED);
-- RETURN(rc);
-+ RETURN(PTR_ERR(task));
- }
-
- l_wait_event(thread->t_ctl_waitq,
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/files/0012-LU-3179-build-fix-compilation-error-with-gcc-4.7.2.patch b/sys-cluster/lustre/files/0012-LU-3179-build-fix-compilation-error-with-gcc-4.7.2.patch
deleted file mode 100644
index cb7c8c8..0000000
--- a/sys-cluster/lustre/files/0012-LU-3179-build-fix-compilation-error-with-gcc-4.7.2.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 15e569cb19f7d46747da8ca461db0869571db0cc Mon Sep 17 00:00:00 2001
-From: Bob Glossman <bob.glossman@intel.com>
-Date: Wed, 24 Apr 2013 06:43:35 -0700
-Subject: [PATCH 12/12] LU-3179 build: fix compilation error with gcc 4.7.2
-
-use cast to resolve build warning from gcc 4.7.2
-
-Signed-off-by: Bob Glossman <bob.glossman@intel.com>
-Change-Id: I4356e621f5b9c687a6b76b12a93b664d542e1c79
----
- lustre/ptlrpc/nrs_crr.c | 2 +-
- lustre/ptlrpc/nrs_orr.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lustre/ptlrpc/nrs_crr.c b/lustre/ptlrpc/nrs_crr.c
-index 0335bf9..6545913 100644
---- a/lustre/ptlrpc/nrs_crr.c
-+++ b/lustre/ptlrpc/nrs_crr.c
-@@ -278,7 +278,7 @@ int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
- {
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
-
-- switch(opc) {
-+ switch((enum nrs_ctl_crr)opc) {
- default:
- RETURN(-EINVAL);
-
-diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c
-index bc4b373..5363629 100644
---- a/lustre/ptlrpc/nrs_orr.c
-+++ b/lustre/ptlrpc/nrs_orr.c
-@@ -759,7 +759,7 @@ int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
- {
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
-
-- switch(opc) {
-+ switch((enum nrs_ctl_orr)opc) {
- default:
- RETURN(-EINVAL);
-
---
-1.8.2.1
-
diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
index e87c114..cb217db 100644
--- a/sys-cluster/lustre/lustre-9999.ebuild
+++ b/sys-cluster/lustre/lustre-9999.ebuild
@@ -33,18 +33,10 @@ DEPEND="${RDEPEND}
virtual/linux-sources"
PATCHES=(
- "${FILESDIR}/0001-LU-1812-kernel-3.7-FC18-server-patches.patch"
- "${FILESDIR}/0002-LU-2686-kernel-sock_map_fd-replaced-by-sock_alloc_fi.patch"
- "${FILESDIR}/0003-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch"
- "${FILESDIR}/0004-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch"
- "${FILESDIR}/0005-LU-2800-llite-introduce-local-getname.patch"
- "${FILESDIR}/0006-LU-2987-llite-rcu-free-inode.patch"
- "${FILESDIR}/0007-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch"
- "${FILESDIR}/0008-LU-2850-kernel-3.8-upstream-kills-daemonize.patch"
- "${FILESDIR}/0009-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch"
- "${FILESDIR}/0010-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch"
- "${FILESDIR}/0011-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch"
- "${FILESDIR}/0012-LU-3179-build-fix-compilation-error-with-gcc-4.7.2.patch"
+ "${FILESDIR}/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch"
+ "${FILESDIR}/0002-LU-2686-kernel-Kernel-update-for-3.7.2-201.fc18.patch"
+ "${FILESDIR}/0003-LU-3079-kernel-3.9-hlist_for_each_entry-uses-3-args.patch"
+ "${FILESDIR}/0004-LU-3079-kernel-f_vfsmnt-replaced-by-f_path.mnt.patch"
)
pkg_setup() {
next reply other threads:[~2013-07-11 15:36 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 15:36 Justin Lecher [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-06-29 10:28 [gentoo-commits] proj/sci:master commit in: sys-cluster/lustre/, sys-cluster/lustre/files/ Alexey Shvetsov
2016-06-12 20:32 Alexey Shvetsov
2016-06-12 19:19 Alexey Shvetsov
2016-06-10 19:06 Alexey Shvetsov
2014-05-29 12:44 Alexey Shvetsov
2014-05-24 22:55 Alexey Shvetsov
2014-05-20 13:44 Alexey Shvetsov
2014-05-20 12:43 Alexey Shvetsov
2014-05-19 9:06 Alexey Shvetsov
2014-04-22 8:41 Alexey Shvetsov
2014-04-22 7:22 Alexey Shvetsov
2014-04-02 12:29 Alexey Shvetsov
2014-04-02 10:50 Alexey Shvetsov
2014-02-27 12:08 Alexey Shvetsov
2014-02-12 6:56 Alexey Shvetsov
2014-02-12 6:39 Alexey Shvetsov
2014-02-12 6:36 Alexey Shvetsov
2014-02-04 11:28 Alexey Shvetsov
2013-12-19 14:21 Alexey Shvetsov
2013-12-19 14:13 Alexey Shvetsov
2013-12-19 13:45 Alexey Shvetsov
2013-12-19 13:29 Alexey Shvetsov
2013-12-19 13:23 Alexey Shvetsov
2013-12-19 12:54 Alexey Shvetsov
2013-07-11 13:25 Alexey Shvetsov
2013-05-07 18:45 Alexey Shvetsov
2013-05-07 9:20 Alexey Shvetsov
2013-04-23 7:43 Alexey Shvetsov
2013-04-22 9:25 Alexey Shvetsov
2013-04-17 9:59 Alexey Shvetsov
2013-04-17 9:45 Alexey Shvetsov
2013-04-16 12:08 Alexey Shvetsov
2013-04-16 11:27 Alexey Shvetsov
2013-03-31 17:20 Alexey Shvetsov
2013-03-31 11:28 Alexey Shvetsov
2013-03-31 11:15 Alexey Shvetsov
2013-03-27 5:05 Alexey Shvetsov
2013-03-22 11:08 Alexey Shvetsov
2013-03-22 10:27 Alexey Shvetsov
2013-03-18 23:14 Alexey Shvetsov
2013-03-18 20:53 Alexey Shvetsov
2013-03-18 14:10 Alexey Shvetsov
2013-03-18 14:00 Alexey Shvetsov
2013-03-18 12:29 Alexey Shvetsov
2013-03-18 12:21 Alexey Shvetsov
2013-03-18 12:13 Alexey Shvetsov
2013-03-18 3:53 Alexey Shvetsov
2013-03-14 11:57 Alexey Shvetsov
2013-03-14 10:21 Alexey Shvetsov
2013-03-14 9:47 Alexey Shvetsov
2013-03-06 12:37 Alexey Shvetsov
2012-09-20 19:15 Alexey Shvetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373556893.763e1015c20a1be5543596f3f7a25afcee576e9a.jlec@gentoo \
--to=jlec@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox