9p: Add fscache support to 9p
Subsystems (3)
PATCH 1/2 9p: Add fscache support to 9p
This patch adds a persistent, read-only caching facility for 9p clients using the FS-Cache caching backend.
When the fscache facility is enabled, each inode is associated with a corresponding vcookie which is an index into the FS-Cache indexing tree. The FS-Cache indexing tree is indexed at 3 levels:
- session object associated with each mount.
- inode/vcookie
- actual data (pages)
A cache tag is chosen randomly for each session. These tags can be read off /sys/fs/9p/caches and can be passed as a mount-time parameter to re-attach to the specified caching session.
--- fs/9p/Kconfig | 9 + fs/9p/Makefile | 3 +- fs/9p/cache.c | 473 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/9p/cache.h | 175 +++++++++++++++++++ fs/9p/v9fs.c | 191 ++++++++++++++++++--- fs/9p/v9fs.h | 13 +- fs/9p/v9fs_vfs.h | 6 + fs/9p/vfs_addr.c | 88 ++++++++++- fs/9p/vfs_file.c | 10 +- fs/9p/vfs_inode.c | 56 ++++++- fs/9p/vfs_super.c | 16 +-- include/net/9p/9p.h | 3 + 12 files changed, 1001 insertions(+), 42 deletions(-) create mode 100644 fs/9p/cache.c create mode 100644 fs/9p/cache.h
fs/9p/Kconfig +9 -0
@@ -8,3 +8,12 @@ config 9P_FS See <http://v9fs.sf.net> for more information. If unsure, say N. + +config 9P_FSCACHE + bool "Enable 9P client caching support (EXPERIMENTAL)" + depends on EXPERIMENTAL + depends on 9P_FS=m && FSCACHE || 9P_FS=y && FSCACHE=y + help + Choose Y here to enable persistent, read-only local + caching support for 9p clients using FS-Cache +
fs/9p/Makefile +2 -1
@@ -8,5 +8,6 @@ obj-$(CONFIG_9P_FS) := 9p.o vfs_dir.o \ vfs_dentry.o \ v9fs.o \ - fid.o \ + fid.o +9p-$(CONFIG_9P_FSCACHE) += cache.o
fs/9p/cache.c new file +473 -0
473 lines not on this page · raw message
fs/9p/cache.h new file +175 -0
175 lines not on this page · raw message
fs/9p/v9fs.c +170 -21
276 lines not on this page · raw message
fs/9p/v9fs.h +9 -4
@@ -51,6 +51,7 @@ enum p9_session_flags {enum p9_cache_modes {CACHE_NONE ,CACHE_LOOSE , +CACHE_FSCACHE , };/**
@@ -60,6 +61,8 @@ enum p9_cache_modes {* @debug: debug level * @afid: authentication handle * @cache: cache mode of type &p9_cache_modes +* @cachetag: the tag of the cache associated with this session +* @fscache: session cookie associated with FS-Cache * @options: copy of options string given by user * @uname: string user name to mount hierarchy as * @aname: mount specifier for remote hierarchy
@@ -68,7 +71,7 @@ enum p9_cache_modes {* @dfltgid: default numeric groupid to mount hierarchy as * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy * @clnt: reference to 9P network client instantiated for this session -* @debugfs_dir: reference to debugfs_dir which can be used for add'l debug +* @slist: reference to list of registered 9p sessions * * This structure holds state for each session instance established during * a sys_mount() .
@@ -84,6 +87,10 @@ struct v9fs_session_info {unsigned short debug;unsigned int afid;unsigned int cache; +#ifdef CONFIG_9P_FSCACHE +char *cachetag; +struct fscache_cookie *fscache; +#endif char *uname;/* user name to mount as */ char *aname;/* name of remote hierarchy being mounted */
@@ -92,11 +99,9 @@ struct v9fs_session_info {unsigned int dfltgid;/* default gid for legacy support */ u32 uid;/* if ACCESS_SINGLE, the uid that has access */ struct p9_client *clnt;/* 9p client */ -struct dentry *debugfs_dir; +struct list_head slist;/* list of sessions registered with v9fs */ }; -extern struct dentry *v9fs_debugfs_root; -struct p9_fid *v9fs_session_init (struct v9fs_session_info *,const char *,char *);void v9fs_session_close (struct v9fs_session_info *v9ses);
fs/9p/v9fs_vfs.h +6 -0
@@ -44,7 +44,13 @@ extern const struct file_operations v9fs_dir_operations;extern const struct dentry_operations v9fs_dentry_operations;extern const struct dentry_operations v9fs_cached_dentry_operations; +#ifdef CONFIG_9P_FSCACHE +struct inode *v9fs_alloc_inode (struct super_block *sb); +void v9fs_destroy_inode (struct inode *inode); +#endif +struct inode *v9fs_get_inode (struct super_block *sb,int mode); +void v9fs_clear_inode (struct inode *inode);ino_t v9fs_qid2ino (struct p9_qid *qid);void v9fs_stat2inode (struct p9_wstat *,struct inode *,struct super_block *);int v9fs_dir_release (struct inode *inode,struct file *filp);
fs/9p/vfs_addr.c +87 -1
117 lines not on this page · raw message
fs/9p/vfs_file.c +8 -2
@@ -41,6 +41,7 @@#include "v9fs.h" #include "v9fs_vfs.h" #include "fid.h" +#include "cache.h" static const struct file_operations v9fs_cached_file_operations;
@@ -86,6 +87,10 @@ int v9fs_file_open(struct inode *inode, struct file *file)/* enable cached file options */ if (file->f_op == &v9fs_file_operations) file->f_op = &v9fs_cached_file_operations; + +#ifdef CONFIG_9P_FSCACHE +v9fs_cache_inode_set_cookie (inode, file); +#endif }return 0 ;
@@ -238,8 +243,9 @@ v9fs_file_write(struct file *filp, const char __user * data,if (total >0 ) { pg_start = origin >>PAGE_CACHE_SHIFT ; pg_end = (origin + total -1 ) >>PAGE_CACHE_SHIFT ; -invalidate_inode_pages2_range (inode->i_mapping, pg_start, - pg_end); +if (inode->i_mapping && inode->i_mapping->nrpages) +invalidate_inode_pages2_range (inode->i_mapping, + pg_start, pg_end); *offset += total;i_size_write (inode,i_size_read (inode) + total); inode->i_blocks = (i_size_read (inode) +512 -1 ) >>9 ;
fs/9p/vfs_inode.c +55 -1
88 lines not on this page · raw message
fs/9p/vfs_super.c +4 -12
@@ -44,21 +44,9 @@#include "v9fs_vfs.h" #include "fid.h" -static void v9fs_clear_inode (struct inode *);static const struct super_operations v9fs_super_ops;/** -* v9fs_clear_inode - release an inode -* @inode: inode to release -* -*/ - -static void v9fs_clear_inode (struct inode *inode) -{ -filemap_fdatawrite (inode->i_mapping); -} - -/** * v9fs_set_super - set the superblock * @s: super block * @data: file system specific data
@@ -220,6 +208,10 @@ v9fs_umount_begin(struct super_block *sb) }static const struct super_operations v9fs_super_ops = { +#ifdef CONFIG_9P_FSCACHE + .alloc_inode = v9fs_alloc_inode, + .destroy_inode = v9fs_destroy_inode, +#endif .statfs = simple_statfs, .clear_inode = v9fs_clear_inode, .show_options = generic_show_options,
include/net/9p/9p.h +3 -0
@@ -38,6 +38,8 @@* @P9_DEBUG_SLABS: memory management tracing * @P9_DEBUG_FCALL: verbose dump of protocol messages * @P9_DEBUG_FID: fid allocation/deallocation tracking +* @P9_DEBUG_PKT: packet marshalling/unmarshalling +* @P9_DEBUG_FSC: FS-cache tracing * * These flags are passed at mount time to turn on various levels of * verbosity and tracing which will be output to the system logs.
@@ -54,6 +56,7 @@ enum p9_debug_flags {P9_DEBUG_FCALL = (1 <<8 ),P9_DEBUG_FID = (1 <<9 ),P9_DEBUG_PKT = (1 <<10 ), + P9_DEBUG_FSC = (1<<11), };#ifdef CONFIG_NET_9P_DEBUG
Signature · 1 line
1.6.3.3
PATCH 2/2 9p: Update documentation to add fscache related bits
Update the documentation to describe FS-Cache related caching parameters. This patch also updates the pointers to 9p-related papers and adds pointer to the Wiki.
--- Documentation/filesystems/9p.txt | 40 ++++++++++++++++++++++++------------- 1 files changed, 26 insertions(+), 14 deletions(-)
Documentation/filesystems/9p.txt +26 -14
@@ -18,11 +18,11 @@ the 9p client is available in the form of a USENIX paper: Other applications are described in the following papers: * XCPU & Clustering - http://www.xcpu.org/xcpu-talk.pdf + http://xcpu.org/papers/xcpu-talk.pdf * KVMFS: control file system for KVM - http://www.xcpu.org/kvmfs.pdf - * CellFS: A New ProgrammingModel for the Cell BE - http://www.xcpu.org/cellfs-talk.pdf + http://xcpu.org/papers/kvmfs.pdf + * CellFS: A New Programming Model for the Cell BE + http://xcpu.org/papers/cellfs-talk.pdf * PROSE I/O: Using 9p to enable Application Partitions http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf
@@ -48,6 +48,7 @@ OPTIONS (see rfdno and wfdno) virtio - connect to the next virtio channel available (from lguest or KVM with trans_virtio module) + rdma - connect to a specified RDMA channel uname=name user name to attempt mount as on the remote server. The server may override or ignore this value. Certain user
@@ -59,16 +60,22 @@ OPTIONS cache=mode specifies a caching policy. By default, no caches are used. loose = no attempts are made at consistency, intended for exclusive, read-only mounts + fscache = use FS-Cache for a persistent, read-only + cache backend. debug=n specifies debug level. The debug level is a bitmask. - 0x01 = display verbose error messages - 0x02 = developer debug (DEBUG_CURRENT) - 0x04 = display 9p trace - 0x08 = display VFS trace - 0x10 = display Marshalling debug - 0x20 = display RPC debug - 0x40 = display transport debug - 0x80 = display allocation debug + 0x01 = display verbose error messages + 0x02 = developer debug (DEBUG_CURRENT) + 0x04 = display 9p trace + 0x08 = display VFS trace + 0x10 = display Marshalling debug + 0x20 = display RPC debug + 0x40 = display transport debug + 0x80 = display allocation debug + 0x100 = display protocol message debug + 0x200 = display Fid debug + 0x400 = display packet debug + 0x800 = display fscache tracing debug rfdno=n the file descriptor for reading with trans=fd
@@ -100,6 +107,10 @@ OPTIONS any = v9fs does single attach and performs all operations as one user + cachetag cache tag to use the specified persistent cache. + cache tags for existing cache sessions can be listed at + /sys/fs/9p/caches. (applies only to cache=fscache) + RESOURCES =========
@@ -118,7 +129,7 @@ and export. A Linux version of the 9p server is now maintained under the npfs project on sourceforge (http://sourceforge.net/projects/npfs). The currently maintained version is the single-threaded version of the server (named spfs) -available from the same CVS repository. +available from the same SVN repository. There are user and developer mailing lists available through the v9fs project on sourceforge (http://sourceforge.net/projects/v9fs).
@@ -126,7 +137,8 @@ on sourceforge (http://sourceforge.net/projects/v9fs). A stand-alone version of the module (which should build for any 2.6 kernel) is available via (http://github.com/ericvh/9p-sac/tree/master) -News and other information is maintained on SWiK (http://swik.net/v9fs). +News and other information is maintained on SWiK (http://swik.net/v9fs) +and the Wiki (http://sf.net/apps/mediawiki/v9fs/index.php). Bug reports may be issued through the kernel.org bugzilla (http://bugzilla.kernel.org)
Signature · 1 line
1.6.3.3
Getting closer, I'm getting an error when I build with make allconfig though:
(You should be checking with allmodconfig,allnoconfig,sparse, etc. before submitting, follow the checklist in Documentation/SubmitChecklist as much as you can)
(Actually, just realized when I wasn't building with allcode, I wasn't testing your code, I can't build with 9P FS Cache enabled)
ericvh@strongmad:~/src/linux/v9fs$ make O=../build/allconfig Using /home/ericvh/src/linux/v9fs as source for kernel GEN /home/ericvh/src/linux/build/allconfig/Makefile CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 CALL /home/ericvh/src/linux/v9fs/scripts/checksyscalls.sh CHK include/linux/compile.h VDSOSYM arch/x86/vdso/vdso-syms.lds VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds VDSOSYM arch/x86/vdso/vdso32-syscall-syms.lds VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds VDSOSYM arch/x86/vdso/vdso32-syms.lds LD arch/x86/vdso/built-in.o LD arch/x86/built-in.o CC [M] fs/9p/cache.o /home/ericvh/src/linux/v9fs/fs/9p/cache.c: In function ‘v9fs_cache_session_get_key’: /home/ericvh/src/linux/v9fs/fs/9p/cache.c:119: error: implicit declaration of function ‘task_pid_nr’ /home/ericvh/src/linux/v9fs/fs/9p/cache.c: In function ‘v9fs_cache_inode_now_uncached’: /home/ericvh/src/linux/v9fs/fs/9p/cache.c:234: error: implicit declaration of function ‘cond_resched’
There also appears to be an error in the mount-time code if we can't connect to the server:
(This one may be a latent regression from older code, I'm trying to track it down now)
[ 612.773569] 9p: p9_fd_create_tcp (4978): p9_trans_tcp: problem connecting socket to 9.3.61.77 [ 612.773660] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 612.773774] IP: [<ffffffffa0292f06>] v9fs_session_close+0x56/0x80 [9p] [ 612.773854] PGD 4251d1067 PUD 424d11067 PMD 0 [ 612.773983] Oops: 0002 [#1] SMP [ 612.774083] last sysfs file: /sys/devices/virtual/block/dm-0/dev [ 612.774128] CPU 3 [ 612.774196] Modules linked in: nfs lockd nfs_acl auth_rpcgss sunrpc
9p 9pnet binfmt_misc ppdev bnep ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp kvm_intel kvm autofs4 video output lp parport snd_hda_codec_analog snd_hda_intel snd_hda_codec snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq iTCO_wdt snd_timer snd_seq_device iTCO_vendor_support snd soundcore psmouse i5000_edac edac_core ics932s401 shpchp serio_raw i5k_amb pcspkr snd_page_alloc ohci1394 floppy ieee1394 tg3
[ 612.776189] Pid: 4978, comm: mount Not tainted 2.6.31 #6 9228MC1 [ 612.776233] RIP: 0010:[<ffffffffa0292f06>] [<ffffffffa0292f06>] v9fs_session_close+0x56/0x80 [9p] [ 612.776319] RSP: 0018:ffff880424cd5d88 EFLAGS: 00010246 [ 612.776363] RAX: 0000000000000000 RBX: ffff88042c1bd720 RCX: ffffffffa0292ef2 [ 612.776408] RDX: 0000000000000000 RSI: ffffea000e79fe80 RDI: ffffffffa0296260 [ 612.776453] RBP: ffff880424cd5d98 R08: 0000000000000000 R09: ffffffffa0292ef2 [ 612.776498] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88042c1bd720 [ 612.776543] R13: ffffffffffffff91 R14: ffff880424c94000 R15: 0000000000000000 [ 612.776589] FS: 00007f9042524780(0000) GS:ffff880028380000(0000) knlGS:0000000000000000 [ 612.776644] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 612.776688] CR2: 0000000000000008 CR3: 000000042c429000 CR4: 00000000000026a0 [ 612.776733] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 612.776778] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 612.776824] Process mount (pid: 4978, threadinfo ffff880424cd4000, task ffff88042e9796c0) [ 612.776878] Stack: [ 612.776918] ffff880424c94000 00000000ffffff91 ffff880424cd5df8 ffffffffa029111c [ 612.777050] <0> ffff880424d16000 ffff88042d955e00 ffff880424d16000 ffffffffa0295fa0 [ 612.777248] <0> 00000000fffffff4 ffff88042d955e00 0000000000000000 ffffffffa0295fa0 [ 612.777483] Call Trace: [ 612.777527] [<ffffffffa029111c>] v9fs_get_sb+0xbc/0x260 [9p] [ 612.777577] [<ffffffff81118425>] vfs_kern_mount+0x75/0x150 [ 612.777621] [<ffffffff8111856e>] do_kern_mount+0x4e/0x110 [ 612.777666] [<ffffffff81131a68>] do_mount+0x6b8/0x950 [ 612.777710] [<ffffffff81131dbb>] sys_mount+0xbb/0xe0 [ 612.777756] [<ffffffff81011f02>] system_call_fastpath+0x16/0x1b [ 612.777800] Code: 5d e1 e8 1e a2 e7 e0 48 8b 73 18 48 8b 3d 8b 09 5d e1 e8 0e a2 e7 e0 48 c7 c7 60 62 29 a0 e8 32 31 28 e1 48 8b 53 38 48 8b 43 40 <48> 89 42 08 48 89 10 48 c7 43 40 00 02 20 00 48 c7 43 38 00 01 [ 612.779748] RIP [<ffffffffa0292f06>] v9fs_session_close+0x56/0x80 [9p] [ 612.779823] RSP <ffff880424cd5d88> [ 612.779864] CR2: 0000000000000008 [ 612.779917] ---[ end trace a94bb7a705d776bf ]---
Quoted 33 lines · Abhishek Kulkarni
This patch adds a persistent, read-only caching facility for 9p clients using the FS-Cache caching backend.
When the fscache facility is enabled, each inode is associated with a corresponding vcookie which is an index into the FS-Cache indexing tree. The FS-Cache indexing tree is indexed at 3 levels:
- session object associated with each mount.
- inode/vcookie
- actual data (pages)A cache tag is chosen randomly for each session. These tags can be read off
/sys/fs/9p/cachesand can be passed as a mount-time parameter to re-attach to the specified caching session.Signed-off-by Abhishek Kulkarni <[email protected]>---
fs/9p/Kconfig | 9 + fs/9p/Makefile | 3 +- fs/9p/cache.c | 473 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/9p/cache.h | 175 +++++++++++++++++++ fs/9p/v9fs.c | 191 ++++++++++++++++++--- fs/9p/v9fs.h | 13 +- fs/9p/v9fs_vfs.h | 6 + fs/9p/vfs_addr.c | 88 ++++++++++- fs/9p/vfs_file.c | 10 +- fs/9p/vfs_inode.c | 56 ++++++- fs/9p/vfs_super.c | 16 +-- include/net/9p/9p.h | 3 + 12 files changed, 1001 insertions(+), 42 deletions(-)create mode 100644
fs/9p/cache.c
create mode 100644fs/9p/cache.hfs/9p/Kconfig +0
-0
Quoted 87 lines · Eric Van Hensbergen
Getting closer, I'm getting an error when I build with make allconfig though:
(You should be checking with allmodconfig,allnoconfig,sparse, etc. before submitting, follow the checklist inDocumentation/SubmitChecklistas much as you can)
(Actually, just realized when I wasn't building with allcode, I wasn't testing your code, I can't build with 9P FS Cache enabled)ericvh@strongmad:~/src/linux/v9fs$ make O=../build/allconfig Using /home/ericvh/src/linux/v9fs as source for kernel GEN /home/ericvh/src/linux/build/allconfig/Makefile CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 CALL /home/ericvh/src/linux/v9fs/scripts/checksyscalls.sh CHK include/linux/compile.h VDSOSYM arch/x86/vdso/vdso-syms.lds VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds VDSOSYM arch/x86/vdso/vdso32-syscall-syms.lds VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds VDSOSYM arch/x86/vdso/vdso32-syms.lds LD arch/x86/vdso/built-in.o LD arch/x86/built-in.o CC [M] fs/9p/cache.o /home/ericvh/src/linux/v9fs/fs/9p/cache.c: In function ‘v9fs_cache_session_get_key’: /home/ericvh/src/linux/v9fs/fs/9p/cache.c:119: error: implicit declaration of function ‘task_pid_nr’ /home/ericvh/src/linux/v9fs/fs/9p/cache.c: In function ‘v9fs_cache_inode_now_uncached’: /home/ericvh/src/linux/v9fs/fs/9p/cache.c:234: error: implicit declaration of function ‘cond_resched’There also appears to be an error in the mount-time code if we can't connect to the server:
(This one may be a latent regression from older code, I'm trying to track it down now)[ 612.773569] 9p:
p9_fd_create_tcp(4978):p9_trans_tcp: problem connecting socket to 9.3.61.77
[ 612.773660] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 612.773774] IP: [<ffffffffa0292f06>]v9fs_session_close+0x56/0x80[9p] [ 612.773854] PGD4251d1067PUD424d11067PMD 0
[ 612.773983] Oops: 0002 [#1] SMP
[ 612.774083] last sysfs file:/sys/devices/virtual/block/dm-0/dev[ 612.774128] CPU 3
[ 612.774196] Modules linked in: nfs lockdnfs_aclauth_rpcgsssunrpc 9p 9pnetbinfmt_miscppdev bnepipt_MASQUERADEiptable_natnf_natnf_conntrack_ipv4nf_defrag_ipv4xt_statenf_conntrackipt_REJECTxt_tcpudpiptable_filterip_tablesx_tablesbridge stpkvm_intelkvm autofs4 video output lp parportsnd_hda_codec_analogsnd_hda_intelsnd_hda_codecsnd_pcm_osssnd_mixer_osssnd_pcmsnd_seq_dummysnd_seq_osssnd_seq_midisnd_rawmidisnd_seq_midi_eventsnd_seqiTCO_wdtsnd_timersnd_seq_deviceiTCO_vendor_supportsnd soundcore psmousei5000_edacedac_coreics932s401 shpchpserio_rawi5k_ambpcspkrsnd_page_allocohci1394 floppy ieee1394 tg3
[ 612.776189] Pid: 4978, comm: mount Not tainted 2.6.31 #6 9228MC1 [ 612.776233] RIP: 0010:[<ffffffffa0292f06>] [<ffffffffa0292f06>]v9fs_session_close+0x56/0x80[9p]
[ 612.776319] RSP: 0018:ffff880424cd5d88 EFLAGS: 00010246
[ 612.776363] RAX: 0000000000000000 RBX:ffff88042c1bd720RCX:ffffffffa0292ef2[ 612.776408] RDX: 0000000000000000 RSI:ffffea000e79fe80RDI:ffffffffa0296260[ 612.776453] RBP:ffff880424cd5d98R08: 0000000000000000 R09:ffffffffa0292ef2[ 612.776498] R10: 0000000000000000 R11: 0000000000000000 R12:ffff88042c1bd720[ 612.776543] R13:ffffffffffffff91R14:ffff880424c94000R15: 0000000000000000 [ 612.776589] FS: 00007f9042524780(0000) GS:ffff880028380000(0000) knlGS:0000000000000000
[ 612.776644] CS: 0010 DS: 0000 ES: 0000 CR0:000000008005003b
[ 612.776688] CR2: 0000000000000008 CR3:000000042c429000CR4:00000000000026a0[ 612.776733] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 612.776778] DR3: 0000000000000000 DR6:00000000ffff0ff0DR7: 0000000000000400 [ 612.776824] Process mount (pid: 4978, threadinfoffff880424cd4000, taskffff88042e9796c0)
[ 612.776878] Stack:
[ 612.776918] ffff880424c9400000000000ffffff91ffff880424cd5df8ffffffffa029111c
[ 612.777050] <0>ffff880424d16000ffff88042d955e00ffff880424d16000ffffffffa0295fa0
[ 612.777248] <0>00000000fffffff4ffff88042d955e000000000000000000ffffffffa0295fa0
[ 612.777483] Call Trace:
[ 612.777527] [<ffffffffa029111c>]v9fs_get_sb+0xbc/0x260[9p]
[ 612.777577] [<ffffffff81118425>]vfs_kern_mount+0x75/0x150
[ 612.777621] [<ffffffff8111856e>]do_kern_mount+0x4e/0x110
[ 612.777666] [<ffffffff81131a68>]do_mount+0x6b8/0x950
[ 612.777710] [<ffffffff81131dbb>]sys_mount+0xbb/0xe0
[ 612.777756] [<ffffffff81011f02>]system_call_fastpath+0x16/0x1b
Quoted 10 lines
[ 612.777800] Code: 5d e1 e8 1e a2 e7 e0 48 8b 73 18 48 8b 3d 8b 09 5d e1 e8 0e a2 e7 e0 48 c7 c7 60 62 29 a0 e8 32 31 28 e1 48 8b 53 38 48 8b 43 40 <48> 89 42 08 48 89 10 48 c7 43 40 00 02 20 00 48 c7 43 38 00 01
[ 612.779748] RIP [<ffffffffa0292f06>]v9fs_session_close+0x56/0x80[9p] [ 612.779823] RSP <ffff880424cd5d88>
[ 612.779864] CR2: 0000000000000008
[ 612.779917] ---[ end tracea94bb7a705d776bf]---
Sorry, this seems to have gotten through with the recent fsc patches. v9fs_session_close() should be more cautious when tearing down the session.
Does the attached patch fix the issue for you?
fs/9p/v9fs.c +0 -0
@@ -228,6 +228,10 @@ struct p9_fid *v9fs_session_init(struct
v9fs_session_info *v9ses,
return ERR_PTR(-ENOMEM);
}+ spin_lock(&v9fs_sessionlist_lock);
+ list_add(&v9ses->slist, &v9fs_sessionlist);
+ spin_unlock(&v9fs_sessionlist_lock);
+
v9ses->flags = V9FS_EXTENDED | V9FS_ACCESS_USER;
strcpy(v9ses->uname, V9FS_DEFUSER);
strcpy(v9ses->aname, V9FS_DEFANAME);
@@ -282,9 +286,6 @@ struct p9_fid *v9fs_session_init(struct
v9fs_session_info *v9ses,
v9fs_cache_session_get_cookie(v9ses);#endif
- spin_lock(&v9fs_sessionlist_lock);
- list_add(&v9ses->slist, &v9fs_sessionlist);
- spin_unlock(&v9fs_sessionlist_lock);
return fid; error:
@@ -305,8 +306,10 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
}
#ifdef CONFIG_9P_FSCACHE
- v9fs_cache_session_put_cookie(v9ses);
- kfree(v9ses->cachetag);
+ if (v9ses->fscache) {
+ v9fs_cache_session_put_cookie(v9ses);
+ kfree(v9ses->cachetag);
+ }
#endif
__putname(v9ses->uname);
__putname(v9ses->aname);Quoted 38 lines
Quoted 33 lines · Abhishek Kulkarni
This patch adds a persistent, read-only caching facility for 9p clients using the FS-Cache caching backend.
When the fscache facility is enabled, each inode is associated with a corresponding vcookie which is an index into the FS-Cache indexing tree. The FS-Cache indexing tree is indexed at 3 levels:
- session object associated with each mount.
- inode/vcookie
- actual data (pages)A cache tag is chosen randomly for each session. These tags can be read off
/sys/fs/9p/cachesand can be passed as a mount-time parameter to re-attach to the specified caching session.Signed-off-by Abhishek Kulkarni <[email protected]>---
fs/9p/Kconfig | 9 + fs/9p/Makefile | 3 +- fs/9p/cache.c | 473 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/9p/cache.h | 175 +++++++++++++++++++ fs/9p/v9fs.c | 191 ++++++++++++++++++--- fs/9p/v9fs.h | 13 +- fs/9p/v9fs_vfs.h | 6 + fs/9p/vfs_addr.c | 88 ++++++++++- fs/9p/vfs_file.c | 10 +- fs/9p/vfs_inode.c | 56 ++++++- fs/9p/vfs_super.c | 16 +-- include/net/9p/9p.h | 3 + 12 files changed, 1001 insertions(+), 42 deletions(-)create mode 100644
fs/9p/cache.c
create mode 100644fs/9p/cache.hfs/9p/Kconfig +0
-0