[ndctl PATCH v2] ndctl, create-namespace: trap and report invalid sector-size values
by Dan Williams
While the kernel will prevent invalid configurations, the user
experience of a kernel error message and disabling of the namespace is
too harsh. Trap and report these attempts to make create-namespace more
user friendly.
# ndctl create-namespace -e namespace0.0 -m sector -l 513 -f -v
validate_namespace_options:437: region0: does not support btt sector_size 513
failed to reconfigure namespace
Reported-by: Yi Zhang <yizhan(a)redhat.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
Changes in v2 to address unit test breakage:
1/ stop setting a default sector size for cases where create-namespace
is operating in pmem mode.
2/ don't set ndns in validate_namespace(), use a separate 'seed'
variable, otherwise we mistakenly change a 'create' to a 'reconfigure'
operation.
ndctl/builtin-xaction-namespace.c | 51 +++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
index 8304203750d8..76d06bbb53ba 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -210,8 +210,13 @@ static int set_defaults(enum namespace_action mode)
error("'pmem' namespaces do not support setting 'sector size'\n");
rc = -EINVAL;
}
- } else if (!param.reconfig)
- param.sector_size = "4096";
+ } else if (!param.reconfig
+ && (param.type && strcmp(param.type, "blk") == 0
+ || (param.mode
+ && strcmp(param.mode, "safe") == 0))) {
+ /* default sector size for blk-type or safe-mode */
+ param.sector_size = "4096";
+ }
return rc;
}
@@ -415,14 +420,44 @@ static int validate_namespace_options(struct ndctl_region *region,
p->mode = ndctl_namespace_get_mode(ndns);
if (param.sector_size) {
- p->sector_size = parse_size64(param.sector_size);
+ struct ndctl_btt *btt;
+ int num, i;
- if (ndns && p->mode != NDCTL_NS_MODE_SAFE
- && ndctl_namespace_get_type(ndns)
- == ND_DEVICE_NAMESPACE_PMEM) {
- debug("%s: does not support sector_size modification\n",
- ndctl_namespace_get_devname(ndns));
+ p->sector_size = parse_size64(param.sector_size);
+ btt = ndctl_region_get_btt_seed(region);
+ if (p->mode == NDCTL_NS_MODE_SAFE) {
+ if (!btt) {
+ debug("%s: does not support 'sector' mode\n",
+ ndctl_region_get_devname(region));
+ return -EINVAL;
+ }
+ num = ndctl_btt_get_num_sector_sizes(btt);
+ for (i = 0; i < num; i++)
+ if (ndctl_btt_get_supported_sector_size(btt, i)
+ == p->sector_size)
+ break;
+ if (i >= num) {
+ debug("%s: does not support btt sector_size %lu\n",
+ ndctl_region_get_devname(region),
+ p->sector_size);
+ return -EINVAL;
+ }
+ } else {
+ struct ndctl_namespace *seed = ndns;
+
+ if (!seed)
+ seed = ndctl_region_get_namespace_seed(region);
+ num = ndctl_namespace_get_num_sector_sizes(seed);
+ for (i = 0; i < num; i++)
+ if (ndctl_namespace_get_supported_sector_size(seed, i)
+ == p->sector_size)
+ break;
+ if (i >= num) {
+ debug("%s: does not support namespace sector_size %lu\n",
+ ndctl_region_get_devname(region),
+ p->sector_size);
return -EINVAL;
+ }
}
} else if (ndns) {
struct ndctl_btt *btt = ndctl_namespace_get_btt(ndns);
4 years, 5 months
OA邮箱升级
by admin
尊敬的领导以及同事:
由于部分离职员工离职办邮箱未上缴,导致资料泄露OA邮统的安全运营!
现请在员工配合邮箱备案登记,逾时未备案的邮箱将删除处理。
点 击 备 案 截止日期:2016年8月11日
4 years, 5 months
[4.8 hang] xfstests generic/361 hangs on dax enabled filesystems
by Dave Chinner
Hi folks,
Just hit a reproducable hang in generic/361. Essentially this on
a 8GB pmem device:
mkfs.xfs -f /dev/pmem1
mount -o dax /dev/pmem1 /mnt/scratch
xfs_io -f -c "truncate 1g" test.img
losetup -f --show /mnt/scratch/test.img
mkfs.xfs -f /dev/loop0
And the mkfs.xfs command hangs with a discard that never completes:
[ 243.413918] INFO: task mkfs.xfs:5708 blocked for more than 120 seconds.
[ 243.415678] Not tainted 4.7.0-dgc+ #862
[ 243.416772] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 243.418769] mkfs.xfs D ffff880835143c18 13848 5708 5441 0x00000000
[ 243.420620] ffff880835143c18 ffff880835143c20 ffff88083a244780 ffff8808358ba3c0
[ 243.422636] ffff88023aa20000 ffff880835144000 7fffffffffffffff 7fffffffffffffff
[ 243.424586] ffff8808358ba3c0 00000000024000c0 ffff880835143c30 ffffffff81e5e38c
[ 243.426466] Call Trace:
[ 243.427050] [<ffffffff81e5e38c>] schedule+0x3c/0x90
[ 243.428224] [<ffffffff81e62be5>] schedule_timeout+0x265/0x330
[ 243.429563] [<ffffffff8109f125>] ? kvm_clock_read+0x25/0x40
[ 243.430896] [<ffffffff8109f149>] ? kvm_clock_get_cycles+0x9/0x10
[ 243.432360] [<ffffffff81125edc>] ? ktime_get+0x3c/0xb0
[ 243.433556] [<ffffffff81e5db54>] io_schedule_timeout+0xa4/0x110
[ 243.434932] [<ffffffff81e5eed6>] wait_for_completion_io+0xd6/0x110
[ 243.436297] [<ffffffff810decd0>] ? wake_up_q+0x70/0x70
[ 243.437436] [<ffffffff817d6f06>] submit_bio_wait+0x56/0x70
[ 243.438671] [<ffffffff817e851a>] blkdev_issue_discard+0x6a/0xb0
[ 243.439980] [<ffffffff810dab69>] ? __might_sleep+0x49/0x80
[ 243.441182] [<ffffffff817eea87>] blk_ioctl_discard+0x97/0xb0
[ 243.442370] [<ffffffff817ef7bb>] blkdev_ioctl+0x7eb/0x9a0
[ 243.443485] [<ffffffff81236a1d>] block_ioctl+0x3d/0x50
[ 243.444552] [<ffffffff812100df>] do_vfs_ioctl+0x8f/0x670
[ 243.445630] [<ffffffff81002434>] ? exit_to_usermode_loop+0x94/0xb0
[ 243.446902] [<ffffffff81210739>] SyS_ioctl+0x79/0x90
[ 243.447927] [<ffffffff81002bc5>] ? syscall_return_slowpath+0xf5/0x190
[ 243.449236] [<ffffffff81e63d32>] entry_SYSCALL_64_fastpath+0x1a/0xa4
This only reproduces when the underlying filesystem is mounted with
-o dax, so there is a bad interaction with loop devices and DAX
occurring somewhere. generic/361 is a recent test (committed june 14)
so this probably hasn't actually been tested until now.
I haven't got time to look at this right now, hence the report.
Cheers,
Dave.
--
Dave Chinner
david(a)fromorbit.com
4 years, 5 months
[ndctl PATCH] ndctl, create-namespace: trap and report invalid sector-size values
by Dan Williams
While the kernel will prevent invalid configurations, the user
experience of a kernel error message and disabling of the namespace is
too harsh. Trap and report these attempts to make create-namespace more
user friendly.
# ndctl create-namespace -e namespace0.0 -m sector -l 513 -f -v
validate_namespace_options:437: region0: does not support btt sector_size 513
failed to reconfigure namespace
Reported-by: Yi Zhang <yizhan(a)redhat.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
ndctl/builtin-xaction-namespace.c | 40 +++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
index 8304203750d8..e136bfdefa39 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -415,14 +415,42 @@ static int validate_namespace_options(struct ndctl_region *region,
p->mode = ndctl_namespace_get_mode(ndns);
if (param.sector_size) {
- p->sector_size = parse_size64(param.sector_size);
+ struct ndctl_btt *btt;
+ int num, i;
- if (ndns && p->mode != NDCTL_NS_MODE_SAFE
- && ndctl_namespace_get_type(ndns)
- == ND_DEVICE_NAMESPACE_PMEM) {
- debug("%s: does not support sector_size modification\n",
- ndctl_namespace_get_devname(ndns));
+ p->sector_size = parse_size64(param.sector_size);
+ btt = ndctl_region_get_btt_seed(region);
+ if (p->mode == NDCTL_NS_MODE_SAFE) {
+ if (!btt) {
+ debug("%s: does not support 'sector' mode\n",
+ ndctl_region_get_devname(region));
+ return -EINVAL;
+ }
+ num = ndctl_btt_get_num_sector_sizes(btt);
+ for (i = 0; i < num; i++)
+ if (ndctl_btt_get_supported_sector_size(btt, i)
+ == p->sector_size)
+ break;
+ if (i >= num) {
+ debug("%s: does not support btt sector_size %lu\n",
+ ndctl_region_get_devname(region),
+ p->sector_size);
return -EINVAL;
+ }
+ } else {
+ if (!ndns)
+ ndns = ndctl_region_get_namespace_seed(region);
+ num = ndctl_namespace_get_num_sector_sizes(ndns);
+ for (i = 0; i < num; i++)
+ if (ndctl_namespace_get_supported_sector_size(ndns, i)
+ == p->sector_size)
+ break;
+ if (i >= num) {
+ debug("%s: does not support namespace sector_size %lu\n",
+ ndctl_region_get_devname(region),
+ p->sector_size);
+ return -EINVAL;
+ }
}
} else if (ndns) {
struct ndctl_btt *btt = ndctl_namespace_get_btt(ndns);
4 years, 5 months
btt device node disappeared after configure with non support sector_size
by Yi Zhang
Hi folks,
Seems I hit one issue that btt device node disappeared after configure with non support sector_size, could you help confirm it?
4.7.0
# ndctl create-namespace -f -e namespace0.0 --mode=sector -l 512
{
"dev":"namespace0.0",
"mode":"sector",
"uuid":"45b4900d-da76-47c8-956f-a70e4ea33fe3",
"sector_size":512,
"blockdev":"pmem0s"
}
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
pmem0s 259:0 0 8G 0 disk
pmem1s 259:2 0 7.1G 0 disk
pmem2s 259:1 0 7.1G 0 disk
pmem3s 259:3 0 7.1G 0 disk
# ndctl create-namespace -f -e namespace0.0 --mode=sector -l 513
failed to reconfigure namespace
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
pmem1s 259:2 0 7.1G 0 disk
pmem2s 259:1 0 7.1G 0 disk
pmem3s 259:3 0 7.1G 0 disk
Best Regards,
Yi Zhang
4 years, 5 months
[ndctl PATCH 0/4] misc updates for v54
by Dan Williams
Some test and output tidy-ups for the next release.
Speaking of ndctl-v54, there's still the pending "btt-size" patch from
Vishal that is awaiting the kernel enabling to land before the release
goes out.
---
Dan Williams (4):
util: require --idle to list 0-sized device-dax instances
test: ensure create.sh always picks a suitable BTT-host namespace
test: skip pmem/blk-ns tests on KVM
test: skip 4.7+ tests on older kernels
ndctl/Makefile.am | 2 +
ndctl/builtin-list.c | 2 +
ndctl/builtin-xaction-namespace.c | 2 +
ndctl/util/json.c | 14 +++++--
ndctl/util/json.h | 3 +-
test/blk_namespaces.c | 17 +++++++++
test/create.sh | 2 +
test/dax-errors.sh | 9 +++++
test/device-dax.sh | 10 +++++
test/libndctl.c | 70 +++++++++++++++++++++++--------------
test/pmem_namespaces.c | 18 ++++++++++
11 files changed, 113 insertions(+), 36 deletions(-)
4 years, 5 months
ii8zilyzjjlhypwnj7y4ycf1jbroux
by pxyduvowx
项目管理实战操作(2天实践型)
【时间地点】 2016年11月24-25 上海 12月22-23 苏州
【参加对象】 项目总监、部门经理、高级项目经理、项目团队成员等,特别适合正在从事项目管理的人员
【授课方式】 讲师讲授+ 案例研讨 +角色扮演 + 讲师点评
【学习费用】 5200元/两天(含两天中餐、指定教材、茶点)
【垂询热线】 0512-6870.0653 (0)180.155.96.327
课程收益
对企业而言,我们确保学员在培训完成后,大家能用同一种理念,同一种方法,同一种图解,同一种表格来完成项目。
参训的每一位学员培训后都将培养成具有以下,项目经理必备的三种能力:
A、确定范围
B、在范围内完成任务的可置信度
C、分析趋势的能力
课程宗旨
“今天培训结束,明天开始动手。”——培训就是为了改变理念,把所学到的管理工具运用到平时的工作中去。
“没有图表就是没有管理,没有数字就是没有控制”。
课程大纲
第一天
一、项目及项目管理(9:00—10:30)
二、项目及其所处的环境分析(10:45—12:00)
三、项目沟通管理(13:00—14:30)
第二天
四、项目范围管理(WBS 和RAM 的制作方法和规定)(9:00—10:30)
五、项目时间管理(网络图的基本制作方法)(13:00—14:30)
六、项目时间管理(带有CPM网络图的制作方法)
七、项目时间管理(9大工具及CPM网络图的10大用途)(14:45—16:30)
4 years, 5 months
[PATCH] libnvdimm: Fix memory leak in error path.
by Johannes Thumshirn
If either device_register() or nvdimm_bus_create_ndclt() fails we leak the
memory allocated for nvdimm_bus. Call kfree(nvdimm_bus) in the error path so
it's not leaked.
Signed-off-by: Johannes Thumshirn <jthumshirn(a)suse.de>
---
drivers/nvdimm/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index be89764..8578365 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -366,6 +366,7 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
return nvdimm_bus;
err:
put_device(&nvdimm_bus->dev);
+ kfree(nvdimm_bus);
return NULL;
}
EXPORT_SYMBOL_GPL(__nvdimm_bus_register);
--
1.8.5.6
4 years, 5 months
HPE SMART data retreival
by Johannes Thumshirn
Hi Dan and Jerry,
I'm currently looking into SMART data retrieval on HPE NVDIMMs.
After the first obstacle (like getting cat
/sys/class/nd/ndctl0/device/nmem0/commands reutrn smart so ndctl will issue
the ioctl) I ran into a rather nasty problem. According to [1] HPEDIMMs
need the input buffer specially crafted for SMART data, according to [2]
Intel DIMMs don't.
Adding translation functions for the DIMMs accepted commands is one thing and
should be more or less trivial for all DIMMs (I'll post an RFC patch as soon
as Linus merged Dan's 4.8 pull request so I can rebase it) but doing this
type of conversation for each and every command for every defined vendor
family for both the input and output buffers will drive us all mad I guess.
Especially from the distribution's POV I'm not to keen on having customers
with some new NVDIMM family and we would need to re-implement all the
translators again. Adding a new ID is one thing but translation tables are a
totally different story.
So the question is have I overlooked something and there is a clean and easy
solution to this problem, or not.
@Jerry have you tested SMART data retrieval with ndctl? Did it work for you?
Thanks,
Johannes
[1] https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_...
[2] http://pmem.io/documents/NVDIMM_DSM_Interface_Example-V1.2.pdf
--
Johannes Thumshirn Storage
jthumshirn(a)suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
4 years, 5 months
[PATCH] block: fix bdi vs gendisk lifetime mismatch
by Dan Williams
The name for a bdi of a gendisk is derived from the gendisk's devt.
However, since the gendisk is destroyed before the bdi it leaves a
window where a new gendisk could dynamically reuse the same devt while a
bdi with the same name is still live. Arrange for the bdi to hold a
reference against its "owner" disk device while it is registered.
Otherwise we can hit sysfs duplicate name collisions like the following:
WARNING: CPU: 10 PID: 2078 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x64/0x80
sysfs: cannot create duplicate filename '/devices/virtual/bdi/259:1'
Hardware name: HP ProLiant DL580 Gen8, BIOS P79 05/06/2015
0000000000000286 0000000002c04ad5 ffff88006f24f970 ffffffff8134caec
ffff88006f24f9c0 0000000000000000 ffff88006f24f9b0 ffffffff8108c351
0000001f0000000c ffff88105d236000 ffff88105d1031e0 ffff8800357427f8
Call Trace:
[<ffffffff8134caec>] dump_stack+0x63/0x87
[<ffffffff8108c351>] __warn+0xd1/0xf0
[<ffffffff8108c3cf>] warn_slowpath_fmt+0x5f/0x80
[<ffffffff812a0d34>] sysfs_warn_dup+0x64/0x80
[<ffffffff812a0e1e>] sysfs_create_dir_ns+0x7e/0x90
[<ffffffff8134faaa>] kobject_add_internal+0xaa/0x320
[<ffffffff81358d4e>] ? vsnprintf+0x34e/0x4d0
[<ffffffff8134ff55>] kobject_add+0x75/0xd0
[<ffffffff816e66b2>] ? mutex_lock+0x12/0x2f
[<ffffffff8148b0a5>] device_add+0x125/0x610
[<ffffffff8148b788>] device_create_groups_vargs+0xd8/0x100
[<ffffffff8148b7cc>] device_create_vargs+0x1c/0x20
[<ffffffff811b775c>] bdi_register+0x8c/0x180
[<ffffffff811b7877>] bdi_register_dev+0x27/0x30
[<ffffffff813317f5>] add_disk+0x175/0x4a0
Cc: <stable(a)vger.kernel.org>
Reported-by: Yi Zhang <yizhan(a)redhat.com>
Tested-by: Yi Zhang <yizhan(a)redhat.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
block/genhd.c | 2 +-
include/linux/backing-dev-defs.h | 1 +
include/linux/backing-dev.h | 1 +
mm/backing-dev.c | 18 ++++++++++++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index 3c9dede4e04f..f6f7ffcd4eab 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -614,7 +614,7 @@ void device_add_disk(struct device *parent, struct gendisk *disk)
/* Register BDI before referencing it from bdev */
bdi = &disk->queue->backing_dev_info;
- bdi_register_dev(bdi, disk_devt(disk));
+ bdi_register_owner(bdi, disk_to_dev(disk));
blk_register_region(disk_devt(disk), disk->minors, NULL,
exact_match, exact_lock, disk);
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 3f103076d0bf..c357f27d5483 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -163,6 +163,7 @@ struct backing_dev_info {
wait_queue_head_t wb_waitq;
struct device *dev;
+ struct device *owner;
struct timer_list laptop_mode_wb_timer;
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 491a91717788..43b93a947e61 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -24,6 +24,7 @@ __printf(3, 4)
int bdi_register(struct backing_dev_info *bdi, struct device *parent,
const char *fmt, ...);
int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
+int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner);
void bdi_unregister(struct backing_dev_info *bdi);
int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index efe237742074..7b51cb7905be 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -825,6 +825,19 @@ int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev)
}
EXPORT_SYMBOL(bdi_register_dev);
+int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner)
+{
+ int rc;
+
+ rc = bdi_register(bdi, NULL, "%u:%u", MAJOR(owner->devt),
+ MINOR(owner->devt));
+ if (rc)
+ return rc;
+ bdi->owner = owner;
+ get_device(owner);
+}
+EXPORT_SYMBOL(bdi_register_owner);
+
/*
* Remove bdi from bdi_list, and ensure that it is no longer visible
*/
@@ -849,6 +862,11 @@ void bdi_unregister(struct backing_dev_info *bdi)
device_unregister(bdi->dev);
bdi->dev = NULL;
}
+
+ if (bdi->owner) {
+ put_device(bdi->owner);
+ bdi->owner = NULL;
+ }
}
void bdi_exit(struct backing_dev_info *bdi)
4 years, 5 months