[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <534840.1641972040@warthog.procyon.org.uk>
Date: Wed, 12 Jan 2022 07:20:40 +0000
From: David Howells <dhowells@...hat.com>
To: Steve French <smfrench@...il.com>
Cc: dhowells@...hat.com, linux-cachefs@...hat.com,
Shyam Prasad N <nspmangalore@...il.com>,
linux-cifs@...r.kernel.org,
Trond Myklebust <trondmy@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Steve French <sfrench@...ba.org>,
Dominique Martinet <asmadeus@...ewreck.org>,
Jeff Layton <jlayton@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Omar Sandoval <osandov@...ndov.com>,
JeffleXu <jefflexu@...ux.alibaba.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-afs@...ts.infradead.org, linux-nfs@...r.kernel.org,
ceph-devel@...r.kernel.org, v9fs-developer@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 63/68] cifs: Support fscache indexing rewrite
Hi Steve,
I think this needs the further changes below, which I will fold in. The
issues are:
(1) One of the error paths in cifs_atomic_open() uses the cookie when it
should jump around that.
(2) There's an additional successful return from the middle of cifs_open()
that I mistook for an error path, but does need to use the cookie on
the way out.
David
---
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 6186824b366e..bf3b4c9901b9 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -508,6 +508,7 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
server->ops->close(xid, tcon, &fid);
cifs_del_pending_open(&open);
rc = -ENOMEM;
+ goto out;
}
fscache_use_cookie(cifs_inode_cookie(file_inode(file)),
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 44da7646f789..47333730c963 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -568,7 +568,7 @@ int cifs_open(struct inode *inode, struct file *file)
spin_lock(&CIFS_I(inode)->deferred_lock);
cifs_del_deferred_close(cfile);
spin_unlock(&CIFS_I(inode)->deferred_lock);
- goto out;
+ goto use_cache;
} else {
_cifsFileInfo_put(cfile, true, false);
}
@@ -630,19 +630,6 @@ int cifs_open(struct inode *inode, struct file *file)
goto out;
}
-
- fscache_use_cookie(cifs_inode_cookie(file_inode(file)),
- file->f_mode & FMODE_WRITE);
- if (file->f_flags & O_DIRECT &&
- (!((file->f_flags & O_ACCMODE) != O_RDONLY) ||
- file->f_flags & O_APPEND)) {
- struct cifs_fscache_inode_coherency_data cd;
- cifs_fscache_fill_coherency(file_inode(file), &cd);
- fscache_invalidate(cifs_inode_cookie(file_inode(file)),
- &cd, i_size_read(file_inode(file)),
- FSCACHE_INVAL_DIO_WRITE);
- }
-
if ((oplock & CIFS_CREATE_ACTION) && !posix_open_ok && tcon->unix_ext) {
/*
* Time to set mode which we can not set earlier due to
@@ -661,6 +648,19 @@ int cifs_open(struct inode *inode, struct file *file)
cfile->pid);
}
+use_cache:
+ fscache_use_cookie(cifs_inode_cookie(file_inode(file)),
+ file->f_mode & FMODE_WRITE);
+ if (file->f_flags & O_DIRECT &&
+ (!((file->f_flags & O_ACCMODE) != O_RDONLY) ||
+ file->f_flags & O_APPEND)) {
+ struct cifs_fscache_inode_coherency_data cd;
+ cifs_fscache_fill_coherency(file_inode(file), &cd);
+ fscache_invalidate(cifs_inode_cookie(file_inode(file)),
+ &cd, i_size_read(file_inode(file)),
+ FSCACHE_INVAL_DIO_WRITE);
+ }
+
out:
free_dentry_path(page);
free_xid(xid);
Powered by blists - more mailing lists