Skip to contentSkip to conversation

cifs: don't allow mmap'ed pages to be dirtied while under writeback (try #2)

PATCH New Jeff Layton 1 participant 1 message Mar 16, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: don't allow mmap'ed pages to be dirtied while under writeback (try #2)

There's no difference between this and try #1, just resending to a wider distribution list.

If a process has a dirty page mapped into its page tables, then it has the ability to change it while the client is trying to write the data out to the server. If that happens after the signature has been calculated then that signature will then be wrong, and the server will likely reset the TCP connection.

This patch adds a page_mkwrite handler for CIFS that simply takes the page lock. Because the page lock is held over the life of writepage and writepages, this prevents the page from becoming writeable until the write call has completed.

With this, we can also remove the "sign_zero_copy" module option and always inline the pages when writing.

---
 fs/cifs/cifsfs.c   |    4 ---
 fs/cifs/cifsglob.h |    1 -
 fs/cifs/file.c     |   62 ++++++++++++++++++++++++++--------------------------
 3 files changed, 31 insertions(+), 36 deletions(-)
fs/cifs/cifsfs.c +0 -4
index de49fbb..1af2470 100644
@@ -81,10 +81,6 @@ module_param(echo_retries, ushort, 0644);
 MODULE_PARM_DESC(echo_retries, "Number of echo attempts before giving up and "
 			       "reconnecting server. Default: 5. 0 means "
 			       "never reconnect.");
-bool sign_zero_copy;  /* globals init to false automatically */
-module_param(sign_zero_copy, bool, 0644);
-MODULE_PARM_DESC(sign_zero_copy, "Don't copy pages on write with signing "
-				 "enabled. Default: N");
 extern mempool_t *cifs_sm_req_poolp;
 extern mempool_t *cifs_req_poolp;
 extern mempool_t *cifs_mid_poolp;
fs/cifs/cifsglob.h +0 -1
index 62b7388..39039d0 100644
@@ -858,7 +858,6 @@ GLOBAL_EXTERN unsigned int CIFSMaxBufSize;  /* max size not including hdr */
 GLOBAL_EXTERN unsigned int cifs_min_rcv;    /* min size of big ntwrk buf pool */
 GLOBAL_EXTERN unsigned int cifs_min_small;  /* min size of small buf pool */
 GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
-GLOBAL_EXTERN bool sign_zero_copy; /* don't copy written pages with signing */
 
 /* reconnect after this many failed echo attempts */
 GLOBAL_EXTERN unsigned short echo_retries;
fs/cifs/file.c +31 -31

98 lines not on this page · raw message

Signature · 1 line
1.7.4