patch-2.4.9 linux/fs/nfs/inode.c
Next file: linux/fs/nfs/unlink.c
Previous file: linux/fs/nfs/file.c
Back to the patch index
Back to the overall index
- Lines: 98
- Date:
Thu Aug 16 09:39:37 2001
- Orig file:
v2.4.8/linux/fs/nfs/inode.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.8/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -48,6 +48,7 @@
static void nfs_write_inode(struct inode *,int);
static void nfs_delete_inode(struct inode *);
static void nfs_put_super(struct super_block *);
+static void nfs_clear_inode(struct inode *);
static void nfs_umount_begin(struct super_block *);
static int nfs_statfs(struct super_block *, struct statfs *);
@@ -57,6 +58,7 @@
delete_inode: nfs_delete_inode,
put_super: nfs_put_super,
statfs: nfs_statfs,
+ clear_inode: nfs_clear_inode,
umount_begin: nfs_umount_begin,
};
@@ -141,6 +143,19 @@
clear_inode(inode);
}
+/*
+ * For the moment, the only task for the NFS clear_inode method is to
+ * release the mmap credential
+ */
+static void
+nfs_clear_inode(struct inode *inode)
+{
+ struct rpc_cred *cred = NFS_I(inode)->mm_cred;
+
+ if (cred)
+ put_rpccred(cred);
+}
+
void
nfs_put_super(struct super_block *sb)
{
@@ -600,7 +615,6 @@
inode->i_ctime = nfs_time_to_secs(fattr->ctime);
NFS_CACHE_CTIME(inode) = fattr->ctime;
NFS_CACHE_MTIME(inode) = fattr->mtime;
- NFS_CACHE_ATIME(inode) = fattr->atime;
NFS_CACHE_ISIZE(inode) = fattr->size;
NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
@@ -794,6 +808,21 @@
}
/*
+ * Ensure that mmap has a recent RPC credential for use when writing out
+ * shared pages
+ */
+static inline void
+nfs_set_mmcred(struct inode *inode, struct rpc_cred *cred)
+{
+ struct rpc_cred **p = &NFS_I(inode)->mm_cred,
+ *oldcred = *p;
+
+ *p = get_rpccred(cred);
+ if (oldcred)
+ put_rpccred(oldcred);
+}
+
+/*
* These are probably going to contain hooks for
* allocating and releasing RPC credentials for
* the file. I'll have to think about Tronds patch
@@ -808,20 +837,20 @@
auth = NFS_CLIENT(inode)->cl_auth;
cred = rpcauth_lookupcred(auth, 0);
filp->private_data = cred;
+ if (filp->f_mode & FMODE_WRITE)
+ nfs_set_mmcred(inode, cred);
unlock_kernel();
return 0;
}
int nfs_release(struct inode *inode, struct file *filp)
{
- struct rpc_auth *auth;
struct rpc_cred *cred;
lock_kernel();
- auth = NFS_CLIENT(inode)->cl_auth;
cred = nfs_file_cred(filp);
if (cred)
- rpcauth_releasecred(auth, cred);
+ put_rpccred(cred);
unlock_kernel();
return 0;
}
@@ -976,7 +1005,6 @@
NFS_CACHE_CTIME(inode) = fattr->ctime;
inode->i_ctime = nfs_time_to_secs(fattr->ctime);
- NFS_CACHE_ATIME(inode) = fattr->atime;
inode->i_atime = nfs_time_to_secs(fattr->atime);
NFS_CACHE_MTIME(inode) = new_mtime;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)