Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df2cf170 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

cifs: overhaul cifs_revalidate and rename to cifs_revalidate_dentry



cifs_revalidate is renamed to cifs_revalidate_dentry as a later patch
will add a by-filehandle variant.

Add a new "invalid_mapping" flag to the cifsInodeInfo that indicates
that the pagecache is considered invalid. Add a new routine to check
inode attributes whenever they're updated and set that flag if the inode
has changed on the server.

cifs_revalidate_dentry is then changed to just update the attrcache if
needed and then to zap the pagecache if it's not valid.

There are some other behavior changes in here as well. Open files are
now allowed to have their caches invalidated. I see no reason why we'd
want to keep stale data around just because a file is open. Also,
cifs_revalidate_cache uses the server_eof for revalidating the file
size since that should more closely match the size of the file on the
server.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 64ba9926
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ cifs_alloc_inode(struct super_block *sb)
	cifs_inode->clientCanCacheRead = false;
	cifs_inode->clientCanCacheAll = false;
	cifs_inode->delete_pending = false;
	cifs_inode->invalid_mapping = false;
	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
	cifs_inode->server_eof = 0;

@@ -638,7 +639,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
		   setting the revalidate time to zero */
		CIFS_I(file->f_path.dentry->d_inode)->time = 0;

		retval = cifs_revalidate(file->f_path.dentry);
		retval = cifs_revalidate_dentry(file->f_path.dentry);
		if (retval < 0)
			return (loff_t)retval;
	}
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ extern int cifs_mkdir(struct inode *, struct dentry *, int);
extern int cifs_rmdir(struct inode *, struct dentry *);
extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
		       struct dentry *);
extern int cifs_revalidate(struct dentry *);
extern int cifs_revalidate_dentry(struct dentry *);
extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
extern int cifs_setattr(struct dentry *, struct iattr *);

+1 −0
Original line number Diff line number Diff line
@@ -389,6 +389,7 @@ struct cifsInodeInfo {
	bool clientCanCacheRead:1;	/* read oplock */
	bool clientCanCacheAll:1;	/* read and writebehind oplock */
	bool delete_pending:1;		/* DELETE_ON_CLOSE is set */
	bool invalid_mapping:1;		/* pagecache is invalid */
	u64  server_eof;		/* current file size on server */
	u64  uniqueid;			/* server inode number */
	struct inode vfs_inode;
+1 −1
Original line number Diff line number Diff line
@@ -739,7 +739,7 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
	int isValid = 1;

	if (direntry->d_inode) {
		if (cifs_revalidate(direntry))
		if (cifs_revalidate_dentry(direntry))
			return 0;
	} else {
		cFYI(1, ("neg dentry 0x%p name = %s",
+1 −1
Original line number Diff line number Diff line
@@ -1894,7 +1894,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
	int rc, xid;

	xid = GetXid();
	rc = cifs_revalidate(dentry);
	rc = cifs_revalidate_dentry(dentry);
	if (rc) {
		cFYI(1, ("Validation prior to mmap failed, error=%d", rc));
		FreeXid(xid);
Loading