CIFS: Make cifsFileInfo_put work with strict cache mode
Subsystems (2)
PATCH 1/6 CIFS: Make cifsFileInfo_put work with strict cache mode
On strict cache mode when we close the last file handle of the inode we should set invalidate flag on the inode and check it during open to prevent data coherency problem when we open it again but it has been modified by other clients.
--- fs/cifs/cifs_fs_sb.h | 1 + fs/cifs/cifsfs.h | 1 + fs/cifs/file.c | 27 +++++++++++++++------------ fs/cifs/inode.c | 3 +-- 4 files changed, 18 insertions(+), 14 deletions(-)
fs/cifs/cifs_fs_sb.h +1 -0
@@ -40,6 +40,7 @@#define CIFS_MOUNT_FSCACHE 0x8000/* local caching enabled */ #define CIFS_MOUNT_MF_SYMLINKS 0x10000/* Minshall+French Symlinks enabled */ #define CIFS_MOUNT_MULTIUSER 0x20000/* multiuser mount */ +#define CIFS_MOUNT_STRICT_IO 0x40000/* strict cache mode */ struct cifs_sb_info {struct rb_root tlink_tree;
fs/cifs/cifsfs.h +1 -0
@@ -61,6 +61,7 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);extern int cifs_revalidate_file (struct file *filp);extern int cifs_revalidate_dentry (struct dentry *); +extern void cifs_invalidate_mapping (struct inode *inode);extern int cifs_getattr (struct vfsmount *,struct dentry *,struct kstat *);extern int cifs_setattr (struct dentry *,struct iattr *);
fs/cifs/file.c +15 -12
@@ -124,19 +124,11 @@ static inline int cifs_open_inode_helper(struct inode *inode, temp =cifs_NTtimeToUnix (buf->LastWriteTime);if (timespec_equal (&inode->i_mtime, &temp) && (inode->i_size == - (loff_t )le64_to_cpu (buf->EndOfFile))) { + (loff_t )le64_to_cpu (buf->EndOfFile)) && + !pCifsInode->invalid_mapping) {cFYI (1 ,"inode unchanged on server" ); - }else { -if (inode->i_mapping) { -/* BB no need to lock inode until after invalidate -since namei code should already have it locked? */ - rc =filemap_write_and_wait (inode->i_mapping); -mapping_set_error (inode->i_mapping, rc); - } -cFYI (1 ,"invalidating remote inode since open detected it " -"changed" ); -invalidate_remote_inode (inode); - } + }else +cifs_invalidate_mapping (inode); client_can_cache:if (pTcon->unix_ext)
@@ -250,6 +242,9 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,cifs_set_oplock_level (pCifsInode, oplock); +if (pCifsInode->invalid_mapping) +cifs_invalidate_mapping (inode); + file->private_data = pCifsFile;return pCifsFile; }
@@ -264,6 +259,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)struct inode *inode = cifs_file->dentry->d_inode;struct cifsTconInfo *tcon =tlink_tcon (cifs_file->tlink);struct cifsInodeInfo *cifsi =CIFS_I (inode); +struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);struct cifsLockInfo *li, *tmp;spin_lock (&cifs_file_list_lock);
@@ -279,6 +275,13 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)if (list_empty (&cifsi->openFileList)) {cFYI (1 ,"closing last open instance for inode %p" , cifs_file->dentry->d_inode); + +/* in strict cache mode we need invalidate mapping on the last +close because it may cause a error when we open this file +again and get at least level II oplock */ +if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_STRICT_IO ) +CIFS_I (inode)->invalid_mapping = true; +cifs_set_oplock_level (cifsi,0 ); }spin_unlock (&cifs_file_list_lock);
fs/cifs/inode.c +1 -2
@@ -1671,8 +1671,7 @@ cifs_inode_needs_reval(struct inode *inode) }/* check invalid_mapping flag and zap the cache if it's set */ -static void -cifs_invalidate_mapping (struct inode *inode) +void cifs_invalidate_mapping (struct inode *inode) {int rc;struct cifsInodeInfo *cifs_i =CIFS_I (inode);
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 1289459222-8210-1-git-send-email-piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 6 lines · On Thu, 11 Nov 2010 10:07:02 +0300 Pavel Shilovsky…
On strict cache mode when we close the last file handle of the inode we should set invalidate flag on the inode and check it during open to prevent data coherency problem when we open it again but it has been modified by other clients.
Signed-off-by Pavel Shilovsky <[email protected]>
When I send multiple versions of the same patch, I usually add "(try #X)" to the subject. That makes it easier for reviewers to tell which patch is the latest version.
Quoted 47 lines
--- fs/cifs/cifs_fs_sb.h | 1 + fs/cifs/cifsfs.h | 1 + fs/cifs/file.c | 27 +++++++++++++++------------ fs/cifs/inode.c | 3 +-- 4 files changed, 18 insertions(+), 14 deletions(-)fs/cifs/cifs_fs_sb.h +1
-0@@ -40,6 +40,7 @@#define CIFS_MOUNT_FSCACHE 0x8000/* local caching enabled */ #define CIFS_MOUNT_MF_SYMLINKS 0x10000/* Minshall+French Symlinks enabled */ #define CIFS_MOUNT_MULTIUSER 0x20000/* multiuser mount */ +#define CIFS_MOUNT_STRICT_IO 0x40000/* strict cache mode */ struct cifs_sb_info {struct rb_root tlink_tree;fs/cifs/cifsfs.h +1
-0@@ -61,6 +61,7 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);extern int cifs_revalidate_file (struct file *filp);extern int cifs_revalidate_dentry (struct dentry *); +extern void cifs_invalidate_mapping (struct inode *inode);extern int cifs_getattr (struct vfsmount *,struct dentry *,struct kstat *);extern int cifs_setattr (struct dentry *,struct iattr *);fs/cifs/file.c +2
-5@@ -124,19 +124,11 @@ static inline int cifs_open_inode_helper(struct inode *inode, temp =cifs_NTtimeToUnix (buf->LastWriteTime);if (timespec_equal (&inode->i_mtime, &temp) && (inode->i_size == - (loff_t )le64_to_cpu (buf->EndOfFile))) { + (loff_t )le64_to_cpu (buf->EndOfFile)) && + !pCifsInode->invalid_mapping) {cFYI (1 ,"inode unchanged on server" ); - }else { -if (inode->i_mapping) { -/* BB no need to lock inode until after invalidate -since namei code should already have it locked? */
fs/cifs/file.c static inline int cifs_open_inode_helper(struct inode *inode, · line 132
Quoted 10 lines
fs/cifs/file.c +2
-7- rc =filemap_write_and_wait (inode->i_mapping); -mapping_set_error (inode->i_mapping, rc); - } -cFYI (1 ,"invalidating remote inode since open detected it " -"changed" ); -invalidate_remote_inode (inode); - } + }else +cifs_invalidate_mapping (inode);
Not directly related to your patch, but what exactly is the purpose of the "open_inode_helper"? It looks like "pile o' random junk that we do for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the d_revalidate phase, and you're going to do it again below in cifs_new_fileinfo.
Quoted 48 lines
fs/cifs/file.c +11
-0client_can_cache:if (pTcon->unix_ext)@@ -250,6 +242,9 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,cifs_set_oplock_level (pCifsInode, oplock); +if (pCifsInode->invalid_mapping) +cifs_invalidate_mapping (inode); + file->private_data = pCifsFile;return pCifsFile; }@@ -264,6 +259,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)struct inode *inode = cifs_file->dentry->d_inode;struct cifsTconInfo *tcon =tlink_tcon (cifs_file->tlink);struct cifsInodeInfo *cifsi =CIFS_I (inode); +struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);struct cifsLockInfo *li, *tmp;spin_lock (&cifs_file_list_lock);@@ -279,6 +275,13 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)if (list_empty (&cifsi->openFileList)) {cFYI (1 ,"closing last open instance for inode %p" , cifs_file->dentry->d_inode); + +/* in strict cache mode we need invalidate mapping on the last +close because it may cause a error when we open this file +again and get at least level II oplock */ +if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_STRICT_IO ) +CIFS_I (inode)->invalid_mapping = true; +cifs_set_oplock_level (cifsi,0 ); }spin_unlock (&cifs_file_list_lock);fs/cifs/inode.c +1
-2@@ -1671,8 +1671,7 @@ cifs_inode_needs_reval(struct inode *inode) }/* check invalid_mapping flag and zap the cache if it's set */ -static void -cifs_invalidate_mapping (struct inode *inode) +void cifs_invalidate_mapping (struct inode *inode) {int rc;struct cifsInodeInfo *cifs_i =CIFS_I (inode);
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20101115073430.2254b19c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org
2010/11/15 Jeff Layton <[email protected]>:
Quoted 3 lines
Not directly related to your patch, but what exactly is the purpose of the "
open_inode_helper"? It looks like "pile o' random junk that we do
I agree that we can replace it with simply calling get_query_info from cifs_open.
Quoted 9 lines
for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the
d_revalidatephase, and you're going to do it again below incifs_new_fileinfo.
I investigated it - you was right about unnecessary calling cifs_invalidate_mapping from open_inode_helper and cifs_new_fileinfo. But I found the following problem:
When we execute script close2_problem.py (see in attachment) several times (e.x. for i in seq 1 20; do ./close2_problem.py; done) with (!) cifsFYI switched off it shows 'a' instead of 'x' (about 1-2 times for 20 runs). If we switch cifsFYI on it is almost always 'x' (true) - I have caught 'a' in this case one or two times for many-many runs. What do you think about it?
Signature · 2 lines
Best regards, Pavel Shilovsky.
#!/bin/env python
#
# We have to mount the same share to test, test1, test2 directories that locate in the directory we
# execute this script from.
from os import open, close, O_RDWR, O_CREAT, write, read, O_RDONLY, O_WRONLY, O_TRUNC, lseek, SEEK_END, SEEK_SET
f = open('test/_test4321_', O_RDWR | O_CREAT | O_TRUNC) close(f)
f1 = open('test1/_test4321_', O_RDWR)write(f1, 'a')
close(f1)
f2 = open('test2/_test4321_', O_WRONLY)write(f2, 'x')
close(f2)
f3 = open('test1/_test4321_', O_RDONLY)
print 'must be x:', read(f3, 1)
close(f3)
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 22 lines
2010/11/15 Jeff Layton <[email protected]>:
Quoted 3 lines
Not directly related to your patch, but what exactly is the purpose of the "
open_inode_helper"? It looks like "pile o' random junk that we doI agree that we can replace it with simply calling
get_query_infofromcifs_open.Quoted 9 lines
for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the
d_revalidatephase, and you're going to do it again below incifs_new_fileinfo.I investigated it - you was right about unnecessary calling
cifs_invalidate_mappingfromopen_inode_helperandcifs_new_fileinfo. But I found the following problem:
Quoted 6 lines
When we execute script
close2_problem.py(see in attachment) several times (e.x. for i inseq 1 20; do ./close2_problem.py; done) with (!) cifsFYI switched off it shows 'a' instead of 'x' (about 1-2 times for 20 runs). If we switch cifsFYI on it is almost always 'x' (true) - I have caught 'a' in this case one or two times for many-many runs. What do you think about it?
I continued the investigation and discovered that if we use invalidate_inode_pages2 instead of invalidate_remote_inode - the problem disappears! So, this is the patch we should apply to solve it (I don't post it as a separate patch? because I think it needs more discussing):
fs/cifs/inode.c +4 -1
@@ -1591,7 +1591,10 @@ cifs_invalidate_mapping(struct inode *inode)if (rc) cifs_i->write_behind_rc = rc; } -invalidate_remote_inode (inode); + +if (inode->i_mapping) +invalidate_inode_pages2 (inode->i_mapping); +cifs_fscache_reset_inode_cookie (inode); }
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTi=e=ExtiYwkWm0tNFVFJWT9nv7HZZB_7PphFKLS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 42 lines
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 22 lines
2010/11/15 Jeff Layton <[email protected]>:
Quoted 3 lines
Not directly related to your patch, but what exactly is the purpose of the "
open_inode_helper"? It looks like "pile o' random junk that we doI agree that we can replace it with simply calling
get_query_infofromcifs_open.Quoted 9 lines
for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the
d_revalidatephase, and you're going to do it again below incifs_new_fileinfo.I investigated it - you was right about unnecessary calling
cifs_invalidate_mappingfromopen_inode_helperandcifs_new_fileinfo. But I found the following problem:Quoted 6 lines
When we execute script
close2_problem.py(see in attachment) several times (e.x. for i inseq 1 20; do ./close2_problem.py; done) with (!) cifsFYI switched off it shows 'a' instead of 'x' (about 1-2 times for 20 runs). If we switch cifsFYI on it is almost always 'x' (true) - I have caught 'a' in this case one or two times for many-many runs. What do you think about it?I continued the investigation and discovered that if we use
invalidate_inode_pages2instead ofinvalidate_remote_inode- the problem disappears! So, this is the patch we should apply to solve it (I don't post it as a separate patch? because I think it needs more discussing):fs/cifs/inode.c +0
-0@@ -1591,7 +1591,10 @@ cifs_invalidate_mapping(struct inode *inode) if (rc)
fs/cifs/inode.c cifs_invalidate_mapping(struct inode *inode) · line 1600
Quoted 10 lines
fs/cifs/inode.c +4
-1cifs_i->write_behind_rc = rc; } - invalidate_remote_inode(inode); + + if (inode->i_mapping) + invalidate_inode_pages2(inode->i_mapping); + cifs_fscache_reset_inode_cookie(inode); }
I have just noticed that Linux kernel NFS client also uses invalidate_inode_pages2 in nfs_revalidate_mapping:
http://git.kernel.org/?p=linux/kernel/git/sfrench/cifs-2.6.git;a=blob;f=fs/nfs/inode.c;h=314f57164602eda0762c0a226db44aa19be461f5;hb=362d31297fafb150676f4d564ecc7f7f3e3b7fd4#l839
Signature · 2 lines
Best regards, Pavel Shilovsky.
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 42 lines
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 22 lines
2010/11/15 Jeff Layton <[email protected]>:
Quoted 3 lines
Not directly related to your patch, but what exactly is the purpose of the "
open_inode_helper"? It looks like "pile o' random junk that we doI agree that we can replace it with simply calling
get_query_infofromcifs_open.Quoted 9 lines
for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the
d_revalidatephase, and you're going to do it again below incifs_new_fileinfo.I investigated it - you was right about unnecessary calling
cifs_invalidate_mappingfromopen_inode_helperandcifs_new_fileinfo. But I found the following problem:Quoted 6 lines
When we execute script
close2_problem.py(see in attachment) several times (e.x. for i inseq 1 20; do ./close2_problem.py; done) with (!) cifsFYI switched off it shows 'a' instead of 'x' (about 1-2 times for 20 runs). If we switch cifsFYI on it is almost always 'x' (true) - I have caught 'a' in this case one or two times for many-many runs. What do you think about it?I continued the investigation and discovered that if we use
invalidate_inode_pages2instead ofinvalidate_remote_inode- the problem disappears! So, this is the patch we should apply to solve it (I don't post it as a separate patch? because I think it needs more discussing):fs/cifs/inode.c +0
-0@@ -1591,7 +1591,10 @@ cifs_invalidate_mapping(struct inode *inode) if (rc)
fs/cifs/inode.c cifs_invalidate_mapping(struct inode *inode) · line 1600
Quoted 10 lines
fs/cifs/inode.c +4
-1cifs_i->write_behind_rc = rc; } - invalidate_remote_inode(inode); + + if (inode->i_mapping) + invalidate_inode_pages2(inode->i_mapping); + cifs_fscache_reset_inode_cookie(inode); }
Sorry, "invalidate" patch above was based on v2.6.36 git tree. Here are the version from cifs master branch:
fs/cifs/inode.c +9 -5
@@ -1679,12 +1679,16 @@ cifs_invalidate_mapping(struct inode *inode) cifs_i->invalid_mapping = false; -/* write back any cached data */ -if (inode->i_mapping && inode->i_mapping->nrpages !=0 ) { - rc =filemap_write_and_wait (inode->i_mapping); -mapping_set_error (inode->i_mapping, rc); +if (inode->i_mapping) { +/* write back any cached data */ +if (inode->i_mapping->nrpages !=0 ) { + rc =filemap_write_and_wait (inode->i_mapping); +mapping_set_error (inode->i_mapping, rc); + } + +invalidate_inode_pages2 (inode->i_mapping); } -invalidate_remote_inode (inode); +cifs_fscache_reset_inode_cookie (inode); }
If everything is ok with it I will post it as a separate patch in right format.
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTi=WzPB6o_f0KL2Sxgdv0Ve4jqK22w8qzdSUTfOj-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 83 lines · On Fri, 19 Nov 2010 14:55:57 +0300 Pavel Shilovsky…
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 42 lines
2010/11/19 Pavel Shilovsky <[email protected]>:
Quoted 22 lines
2010/11/15 Jeff Layton <[email protected]>:
Quoted 3 lines
Not directly related to your patch, but what exactly is the purpose of the "
open_inode_helper"? It looks like "pile o' random junk that we doI agree that we can replace it with simply calling
get_query_infofromcifs_open.Quoted 9 lines
for non-posix opens". Maybe it would be best to eliminate that function altogether and further unify the posix and non-posix open code. Steve, care to comment?
Now that I'm done ranting, I don't think the invalidate mapping call here is unnecessary. We will likely have already invalidated the cache during the
d_revalidatephase, and you're going to do it again below incifs_new_fileinfo.I investigated it - you was right about unnecessary calling
cifs_invalidate_mappingfromopen_inode_helperandcifs_new_fileinfo. But I found the following problem:Quoted 6 lines
When we execute script
close2_problem.py(see in attachment) several times (e.x. for i inseq 1 20; do ./close2_problem.py; done) with (!) cifsFYI switched off it shows 'a' instead of 'x' (about 1-2 times for 20 runs). If we switch cifsFYI on it is almost always 'x' (true) - I have caught 'a' in this case one or two times for many-many runs. What do you think about it?I continued the investigation and discovered that if we use
invalidate_inode_pages2instead ofinvalidate_remote_inode- the problem disappears! So, this is the patch we should apply to solve it (I don't post it as a separate patch? because I think it needs more discussing):fs/cifs/inode.c +0
-0@@ -1591,7 +1591,10 @@ cifs_invalidate_mapping(struct inode *inode) if (rc)fs/cifs/inode.c cifs_invalidate_mapping(struct inode *inode) · line 1600
Quoted 10 lines
fs/cifs/inode.c +4
-1cifs_i->write_behind_rc = rc; } - invalidate_remote_inode(inode); + + if (inode->i_mapping) + invalidate_inode_pages2(inode->i_mapping); + cifs_fscache_reset_inode_cookie(inode); }Sorry, "invalidate" patch above was based on v2.6.36 git tree. Here are the version from cifs master branch:
fs/cifs/inode.c +9
-5@@ -1679,12 +1679,16 @@ cifs_invalidate_mapping(struct inode *inode) cifs_i->invalid_mapping = false; -/* write back any cached data */ -if (inode->i_mapping && inode->i_mapping->nrpages !=0 ) { - rc =filemap_write_and_wait (inode->i_mapping); -mapping_set_error (inode->i_mapping, rc); +if (inode->i_mapping) { +/* write back any cached data */ +if (inode->i_mapping->nrpages !=0 ) { + rc =filemap_write_and_wait (inode->i_mapping); +mapping_set_error (inode->i_mapping, rc); + } + +invalidate_inode_pages2 (inode->i_mapping); } -invalidate_remote_inode (inode); +cifs_fscache_reset_inode_cookie (inode); }
Quoted 2 lines
If everything is ok with it I will post it as a separate patch in right format.
I don't think we should apply any patches to fix a problem that we don't really understand. If it mostly goes away with cifsFYI turned on then it sounds like a race condition of some sort. It looks like invalidate_inode_pages2 invalidates locked pages whereas invalidate_remote_inode doesn't, so that may be a hint, or it could just change the timing of the race.
You'll need to ascertain the nature of the race to ensure that the fix is really fixing the problem and not just papering over the bug.
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20101119113350.606a4598-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org
2010/11/19 Jeff Layton <[email protected]>:
Quoted 11 lines
On Fri, 19 Nov 2010 14:55:57 +0300
I don't think we should apply any patches to fix a problem that we don't really understand. If it mostly goes away with cifsFYI turned on then it sounds like a race condition of some sort. It looks likeinvalidate_inode_pages2invalidates locked pages whereasinvalidate_remote_inodedoesn't, so that may be a hint, or it could just change the timing of the race.You'll need to ascertain the nature of the race to ensure that the fix is really fixing the problem and not just papering over the bug.
I checked all the lock/unlock calls for pages in CIFS code and didn't find any problem places. I added debug message that shows how many pages invalidate_remote_inode invalidates and for wrong case it is 0:
/home/piastry/git/cifs-2.6/fs/cifs/file.c: CIFS VFS: in cifs_close as
Xid: 1922 with uid: 500
/home/piastry/git/cifs-2.6/fs/cifs/cifssmb.c: In CIFSSMBClose /home/piastry/git/cifs-2.6/fs/cifs/transport.c: For smb_command 4 /home/piastry/git/cifs-2.6/fs/cifs/transport.c: Sending smb: total_len 45 /home/piastry/git/cifs-2.6/fs/cifs/connect.c: rfc1002 length 0x27 /home/piastry/git/cifs-2.6/fs/cifs/file.c: closing last open instance
for inode e2402828
/home/piastry/git/cifs-2.6/fs/cifs/file.c: CIFS VFS: leavingcifs_close (xid = 1922) rc = 0
/home/piastry/git/cifs-2.6/fs/cifs/inode.c: CIFS VFS: incifs_revalidate as Xid: 1923 with uid: 500
/home/piastry/git/cifs-2.6/fs/cifs/inode.c: Revalidate: /_test4321_
inode 0xe2402690 count 1 dentry: 0xf6f0b550 d_time 1962130 jiffies 2313421
/home/piastry/git/cifs-2.6/fs/cifs/file.c: CIFS VFS: incifs_writepages as Xid: 1924 with uid: 500
/home/piastry/git/cifs-2.6/fs/cifs/file.c: CIFS VFS: leavingcifs_writepages (xid = 1924) rc = 0
/home/piastry/git/cifs-2.6/fs/cifs/inode.c: invalidating remote inode
since open detected it changed
/home/piastry/git/cifs-2.6/fs/cifs/inode.c: invalidate returned: 0 ^^^
/home/piastry/git/cifs-2.6/fs/cifs/inode.c: CIFS VFS: leavingcifs_revalidate (xid = 1923) rc = 0
/home/piastry/git/cifs-2.6/fs/cifs/file.c: CIFS VFS: in cifs_open as
Xid: 1925 with uid: 500
/home/piastry/git/cifs-2.6/fs/cifs/file.c: inode = 0xe2402690 file
flags are 0x8000 for /_test4321_
For right cases it is "invalidate returned: 1". This message was taken from dmesg after a run of my python script I posted before.
So, the page can be locked and then successfully unlocked by VFS (because invalidate_inode_pages2 locks a page before processing it). Anyway I think we shouldn't use invalidate_remote_inode at all - we can miss pages that are under some VFS process. In this case invalidate_inode_pages2 is ok - I don't think it can break any things.
Signature · 2 lines
Best regards, Pavel Shilovsky.