All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] nvmet: add revalidate support
@ 2020-04-08  4:16 Chaitanya Kulkarni
  2020-04-08  4:16 ` [PATCH V2 1/2] nvmet: add ns revalidation support Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Chaitanya Kulkarni @ 2020-04-08  4:16 UTC (permalink / raw)
  To: linux-nvme; +Cc: ailiop, hch, Chaitanya Kulkarni, sagi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4484 bytes --]

Hi,

This patch series adds support for the NVMeOF target bdev-ns and
file-ns size re-validation.

The first patch adds bdev/file backend revalidation helpers which
was posted by Anthony Iliopoulos. I've fixed the comments posted on V1
by keeping the authorship of the patch.

The 2nd patch is needed since the change of size detection on the target
should generate the AEN to the host. Right now there is no mechanism
that allows us to add callbacks for the block and file backend so that
we will get the notification (if anyone knows please let me know, I'll
be happy rework this series). So this just adds a simple per namespace
thread which checks for the size change and generates AEN when needed.

I'm open to use different thread model.

Without second Patch:-
-------------------
1. Build null_blk based XFS file system :-
[ 3854.406993] XFS (nullb0): Unmounting Filesystem
[ 3865.803947] null_blk: module loaded
[ 3869.870398] XFS (nullb0): Mounting V5 Filesystem
[ 3869.873697] XFS (nullb0): Ending clean mount
[ 3869.873826] xfs filesystem being mounted at /mnt/backend supports timestamps until 2038 (0x7fffffff)
2. Add nvmet file backed namespaces and connect to host with nvme_loop.ko.
[ 3889.258370] nvmet: adding nsid 1 to subsystem fs
[ 3890.276583] nvmet: creating controller 1 for subsystem fs for NQN nqn.2014-08.org.nvmexpress:uuid:f67d5ee8-b2df-44a3-81f2-c827705db7e2.
[ 3890.277202] nvme nvme1: creating 64 I/O queues.
[ 3890.293196] nvme nvme1: new ctrl: "fs"
[ 3890.295363] nvme1n1: detected capacity change from 0 to 10737418240
# dmesg -c 
# dmesg -c 
3. Verify the backend file information :-
# cat /sys/kernel/config/nvmet/subsystems/fs/namespaces/1/device_path
/mnt/backend/nvme1n1
# file /mnt/backend/nvme1n1
/mnt/backend/nvme1n1: data
# ls -lrth /mnt/backend/nvme1n1
-rw-r--r--. 1 root root 10G Apr  7 20:51 /mnt/backend/nvme1n1
4. Change the size of the backend file :-
# truncate -s 5G /mnt/backend/nvme1n1
# dmesg -c 
# dmesg -c 
5. Check the host size block device size.
# lsblk | grep nvme1n1
nvme1n1           259:11   0   10G  0 disk <-----------------------
#

With the second patch:-
--------------------
1. Build null_blk based XFS file system :-
[ 3979.363104] null_blk: module loaded
[ 3983.418615] XFS (nullb0): Mounting V5 Filesystem
[ 3983.421752] XFS (nullb0): Ending clean mount
[ 3983.421887] xfs filesystem being mounted at /mnt/backend supports timestamps until 2038 (0x7fffffff)
2. Add nvmet file backed namespaces and connect to host with nvme_loop.ko.
[ 4002.801019] nvmet: adding nsid 1 to subsystem fs
[ 4003.818375] nvmet: creating controller 1 for subsystem fs for NQN nqn.2014-08.org.nvmexpress:uuid:3c1d7670-7f65-41b5-b488-9249220b76e8.
[ 4003.819076] nvme nvme1: creating 64 I/O queues.
[ 4003.834461] nvme nvme1: new ctrl: "fs"
[ 4003.837448] nvme1n1: detected capacity change from 0 to 10737418240
# dmesg -c 
3. Verify the backend file information :-
# cat /sys/kernel/config/nvmet/subsystems/fs/namespaces/1/device_path
/mnt/backend/nvme1n1
# file /mnt/backend/nvme1n1
/mnt/backend/nvme1n1: data
# ls -lrth /mnt/backend/nvme1n1
-rw-r--r--. 1 root root 10G Apr  7 20:53 /mnt/backend/nvme1n1
4. Change the size of the backend file :-
# truncate -s 5G /mnt/backend/nvme1n1
# dmesg -c 
[ 4041.181065] nvme nvme1: rescanning namespaces.
[ 4041.529446] nvme1n1: detected capacity change from 10737418240 to 5368709120
# lsblk | grep nvme1n1
5. Check the host size block device size.
nvme1n1           259:12   0    5G  0 disk <-----------------------
# 

Regards,
Chaitanya

Changes from V1 :-

1. Just use ns->size = i_size_read(ns->bdev->bd_inode) in the
   nvmet_bdev_ns_revalidate().
2. Remove !file check and use fill line for vfs_getattr() call in
   nvmet_file_ns_revalidate().
3. Add wrapper nvmet_ns_revalidate().
4. Add 2nd patch to introduce per namespace thread to monitor the size by
   calling nvmet_ns_revalidate() and generate AEN when size change is
   detected.  
5. Change return type of the nvmet_[bdev|file]ns_revalidate() from void
   to bool.

Anthony Iliopoulos (1):
  nvmet: add ns revalidation support

Chaitanya Kulkarni (1):
  nvmet: add per ns thread to generate AEN

 drivers/nvme/target/admin-cmd.c   |  2 ++
 drivers/nvme/target/core.c        | 34 +++++++++++++++++++++++++++++++
 drivers/nvme/target/io-cmd-bdev.c | 12 +++++++++++
 drivers/nvme/target/io-cmd-file.c | 16 +++++++++++++++
 drivers/nvme/target/nvmet.h       |  4 ++++
 5 files changed, 68 insertions(+)

-- 
2.22.1



[-- Attachment #2: Type: text/plain, Size: 158 bytes --]

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2020-04-20  0:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08  4:16 [PATCH V2 0/2] nvmet: add revalidate support Chaitanya Kulkarni
2020-04-08  4:16 ` [PATCH V2 1/2] nvmet: add ns revalidation support Chaitanya Kulkarni
2020-04-08  4:16 ` [PATCH V2 2/2] nvmet: add per ns thread to generate AEN Chaitanya Kulkarni
2020-04-08  5:33   ` Sagi Grimberg
2020-04-08  5:43     ` Chaitanya Kulkarni
2020-04-08  5:48       ` Chaitanya Kulkarni
2020-04-08  5:55       ` Sagi Grimberg
2020-04-08 15:12         ` Chaitanya Kulkarni
2020-04-10  4:07           ` Sagi Grimberg
2020-04-20  0:13             ` Chaitanya Kulkarni
2020-04-08  9:55     ` Anthony Iliopoulos
2020-04-08 15:25       ` Chaitanya Kulkarni
2020-04-08 17:08         ` Anthony Iliopoulos
2020-04-08 23:28           ` Chaitanya Kulkarni
2020-04-09  9:41             ` Anthony Iliopoulos
2020-04-20  0:20               ` Chaitanya Kulkarni
2020-04-08  5:24 ` [PATCH V2 0/2] nvmet: add revalidate support Chaitanya Kulkarni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.