linux/fs/cifs
David Howells 94d30ae90a FS-Cache: Provide the ability to enable/disable cookies
Provide the ability to enable and disable fscache cookies.  A disabled cookie
will reject or ignore further requests to:

	Acquire a child cookie
	Invalidate and update backing objects
	Check the consistency of a backing object
	Allocate storage for backing page
	Read backing pages
	Write to backing pages

but still allows:

	Checks/waits on the completion of already in-progress objects
	Uncaching of pages
	Relinquishment of cookies

Two new operations are provided:

 (1) Disable a cookie:

	void fscache_disable_cookie(struct fscache_cookie *cookie,
				    bool invalidate);

     If the cookie is not already disabled, this locks the cookie against other
     dis/enablement ops, marks the cookie as being disabled, discards or
     invalidates any backing objects and waits for cessation of activity on any
     associated object.

     This is a wrapper around a chunk split out of fscache_relinquish_cookie(),
     but it reinitialises the cookie such that it can be reenabled.

     All possible failures are handled internally.  The caller should consider
     calling fscache_uncache_all_inode_pages() afterwards to make sure all page
     markings are cleared up.

 (2) Enable a cookie:

	void fscache_enable_cookie(struct fscache_cookie *cookie,
				   bool (*can_enable)(void *data),
				   void *data)

     If the cookie is not already enabled, this locks the cookie against other
     dis/enablement ops, invokes can_enable() and, if the cookie is not an
     index cookie, will begin the procedure of acquiring backing objects.

     The optional can_enable() function is passed the data argument and returns
     a ruling as to whether or not enablement should actually be permitted to
     begin.

     All possible failures are handled internally.  The cookie will only be
     marked as enabled if provisional backing objects are allocated.

A later patch will introduce these to NFS.  Cookie enablement during nfs_open()
is then contingent on i_writecount <= 0.  can_enable() checks for a race
between open(O_RDONLY) and open(O_WRONLY/O_RDWR).  This simplifies NFS's cookie
handling and allows us to get rid of open(O_RDONLY) accidentally introducing
caching to an inode that's open for writing already.

One operation has its API modified:

 (3) Acquire a cookie.

	struct fscache_cookie *fscache_acquire_cookie(
		struct fscache_cookie *parent,
		const struct fscache_cookie_def *def,
		void *netfs_data,
		bool enable);

     This now has an additional argument that indicates whether the requested
     cookie should be enabled by default.  It doesn't need the can_enable()
     function because the caller must prevent multiple calls for the same netfs
     object and it doesn't need to take the enablement lock because no one else
     can get at the cookie before this returns.

Signed-off-by: David Howells <dhowells@redhat.com
2013-09-27 18:40:25 +01:00
..
Kconfig [CIFS] SMB3 Signing enablement 2013-06-26 23:45:05 -05:00
Makefile cifs: add new case-insensitive conversion routines that are based on wchar_t's 2013-09-08 14:38:05 -05:00
asn1.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cache.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cifs_debug.c cifs: try to handle the MUST SecurityFlags sanely 2013-06-26 17:31:55 -05:00
cifs_debug.h [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cifs_dfs_ref.c cifs: fix composing of mount options for DFS referrals 2013-05-24 13:08:31 -05:00
cifs_fs_sb.h cifs: Convert struct cifs_sb_info to use kuids and kgids 2013-02-13 07:28:54 -08:00
cifs_spnego.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cifs_spnego.h [CIFS] Rename three structures to avoid camel case 2011-05-27 04:34:02 +00:00
cifs_unicode.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cifs_unicode.h cifs: add new case-insensitive conversion routines that are based on wchar_t's 2013-09-08 14:38:05 -05:00
cifs_uniupr.h cifs: correction of unicode header files 2010-08-20 00:46:42 +00:00
cifsacl.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
cifsacl.h cifs: fix SID binary to string conversion 2012-12-11 11:48:49 -06:00
cifsencrypt.c cifs: fix bad error handling in crypto code 2013-07-31 13:44:59 -05:00
cifsfs.c CIFS: Respect epoch value from create lease context v2 2013-09-09 22:52:18 -05:00
cifsfs.h Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 2013-07-03 14:06:30 -07:00
cifsglob.h CIFS: Respect epoch value from create lease context v2 2013-09-09 22:52:18 -05:00
cifspdu.h CIFS: Implement follow_link for nounix CIFS mounts 2013-09-08 14:27:41 -05:00
cifsproto.h cifs: Start using per session key for smb2/3 for signature generation 2013-09-08 14:47:50 -05:00
cifssmb.c CIFS: Implement follow_link for nounix CIFS mounts 2013-09-08 14:27:41 -05:00
connect.c CIFS: Store lease state itself rather than a mapped oplock value 2013-09-09 22:52:05 -05:00
dir.c cifs: fix filp leak in cifs_atomic_open() 2013-09-16 19:17:24 -04:00
dns_resolve.c cifs: fix composing of mount options for DFS referrals 2013-05-24 13:08:31 -05:00
dns_resolve.h DNS: Separate out CIFS DNS Resolver code 2010-08-05 17:17:51 +00:00
export.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
file.c cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache 2013-09-13 16:24:49 -05:00
fscache.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
fscache.h [CIFS] Rename three structures to avoid camel case 2011-05-27 04:34:02 +00:00
inode.c Merge branch 'akpm' (patches from Andrew Morton) 2013-09-12 15:44:27 -07:00
ioctl.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
link.c CIFS: Implement follow_link for SMB2 2013-09-08 14:27:34 -05:00
misc.c CIFS: Replace clientCanCache* bools with an integer 2013-09-08 17:49:17 -05:00
netmisc.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
nterr.c CIFS: Rename 7 error codes to NT_ style 2012-07-24 10:25:10 -05:00
nterr.h CIFS: Rename 7 error codes to NT_ style 2012-07-24 10:25:10 -05:00
ntlmssp.h CIFS: Add session setup/logoff capability for SMB2 2012-07-24 21:54:57 +04:00
readdir.c CIFS: Implement follow_link for SMB2 2013-09-08 14:27:34 -05:00
rfc1002pdu.h [CIFS] whitespace cleanup 2007-06-05 18:30:44 +00:00
sess.c cifs: Add a variable specific to NTLMSSP for key exchange. 2013-09-08 14:47:49 -05:00
smb1ops.c CIFS: Store lease state itself rather than a mapped oplock value 2013-09-09 22:52:05 -05:00
smb2file.c CIFS: Store lease state itself rather than a mapped oplock value 2013-09-09 22:52:05 -05:00
smb2glob.h [CIFS] SMB3 Signing enablement 2013-06-26 23:45:05 -05:00
smb2inode.c CIFS: Implement follow_link for SMB2 2013-09-08 14:27:34 -05:00
smb2maperror.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
smb2misc.c CIFS: Respect epoch value from create lease context v2 2013-09-09 22:52:18 -05:00
smb2ops.c CIFS: Respect epoch value from create lease context v2 2013-09-09 22:52:18 -05:00
smb2pdu.c CIFS: Respect epoch value from create lease context v2 2013-09-09 22:52:18 -05:00
smb2pdu.h CIFS: Add create lease v2 context for SMB3 2013-09-09 22:52:14 -05:00
smb2proto.h CIFS: Store lease state itself rather than a mapped oplock value 2013-09-09 22:52:05 -05:00
smb2status.h CIFS: Add SMB2 status codes 2012-07-24 10:25:13 -05:00
smb2transport.c cifs: Start using per session key for smb2/3 for signature generation 2013-09-08 14:47:50 -05:00
smbencrypt.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00
smberr.h cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS 2010-08-02 12:40:40 +00:00
smbfsctl.h Update headers to update various SMB3 ioctl definitions 2013-06-24 01:56:47 -05:00
transport.c Power management and ACPI updates for 3.11-rc1 2013-07-03 14:35:40 -07:00
winucase.c [CIFS] quiet sparse compile warning 2013-09-08 14:54:24 -05:00
xattr.c [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg 2013-05-04 22:17:23 -05:00