On Mon, 25 Jun 2001, Trond Myklebust wrote:
> As I said, the patch looks good, and the races are gone. The only
> question I have is about the above section in nfs_fhget(). AFAICS the
> NFS_CACHEINV() you've inserted here will get clobbered by the
> nfs_refresh_inode() below it.
Erm... Sorry - the thing got moved in there from nfs_read_inode(). Along
with the old contents of nfs_fill_inode(). I've collapsed obviously redundant
stuff, but I might easily miss some.
So the real question is whether the current code needs it in nfs_read_inode()
or not. <looking> OK, so it doesn't.
Fine. I've moved call of nfs_refresh_inode() into both branches, expanded
it in the "got the new inode, need to fill it" one and removed the redundant
stuff there.
Another thing: init_nfs_fs() doesn't clean up after itself in case of failure.
Fixed.
Here's the patch (incremental to previous):
diff -urN S6-pre5-nfs-0/fs/nfs/inode.c S6-pre5-nfs/fs/nfs/inode.c
--- S6-pre5-nfs-0/fs/nfs/inode.c Mon Jun 25 14:27:49 2001
+++ S6-pre5-nfs/fs/nfs/inode.c Mon Jun 25 14:27:30 2001
@@ -654,7 +654,23 @@
if (!inode->u.generic_ip) {
inode->i_mode = fattr->mode;
- inode->i_blksize = inode->i_sb->s_blocksize;
+ inode->i_nlink = fattr->nlink;
+ inode->i_uid = fattr->uid;
+ inode->i_gid = fattr->gid;
+ inode->i_size = nfs_size_to_loff_t(fattr->size);
+ inode->i_mtime = nfs_time_to_secs(fattr->mtime);
+ inode->i_atime = nfs_time_to_secs(fattr->atime);
+ inode->i_ctime = nfs_time_to_secs(fattr->ctime);
+ if (fattr->valid & NFS_ATTR_FATTR_V3) {
+ /*
+ * report the blocks in 512byte units
+ */
+ inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
+ inode->i_blksize = inode->i_sb->s_blocksize;
+ } else {
+ inode->i_blocks = fattr->du.nfs2.blocks;
+ inode->i_blksize = fattr->du.nfs2.blocksize;
+ }
inode->i_rdev = 0;
/*
* We can't support UPDATE_ATIME(), since the server
@@ -664,6 +680,7 @@
inode->u.generic_ip = nfsi;
NFS_FILEID(inode) = fattr->fileid;
NFS_FSID(inode) = fattr->fsid;
+ memcpy(NFS_FH(inode), fh, sizeof(struct nfs_fh));
NFS_FLAGS(inode) = 0;
INIT_LIST_HEAD(&nfsi->read);
INIT_LIST_HEAD(&nfsi->dirty);
@@ -673,7 +690,6 @@
nfsi->ndirty = 0;
nfsi->ncommit = 0;
nfsi->npages = 0;
- NFS_CACHEINV(inode);
/* Why so? Because we want revalidate for devices/FIFOs, and
* that's precisely what we have in nfs_file_inode_operations.
*/
@@ -692,26 +708,21 @@
* Preset the size and mtime, as there's no need
* to invalidate the caches.
*/
- inode->i_size = nfs_size_to_loff_t(fattr->size);
- inode->i_mtime = nfs_time_to_secs(fattr->mtime);
- inode->i_atime = nfs_time_to_secs(fattr->atime);
- 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;
- memcpy(NFS_FH(inode), fh, sizeof(struct nfs_fh));
+ NFS_READTIME(inode) = jiffies;
} else {
kmem_cache_free(nfs_inode_cachep, nfsi);
+ nfs_refresh_inode(inode, fattr);
}
- nfs_refresh_inode(inode, fattr);
dprintk("NFS: __nfs_fhget(%x/%Ld ct=%d)\n",
inode->i_dev, (long long)NFS_FILEID(inode),
atomic_read(&inode->i_count));
-
out:
return inode;
@@ -1079,20 +1090,32 @@
err = nfs_init_nfspagecache();
if (err)
- return err;
+ goto out3;
err = nfs_init_inodecache();
if (err)
- return err;
+ goto out2;
err = nfs_init_readpagecache();
if (err)
- return err;
+ goto out1;
#ifdef CONFIG_PROC_FS
rpc_proc_register(&nfs_rpcstat);
#endif
- return register_filesystem(&nfs_fs_type);
+ err = register_filesystem(&nfs_fs_type);
+ if (err)
+ goto out;
+ return 0;
+out:
+ rpc_proc_unregister("nfs");
+ nfs_destroy_readpagecache();
+out1:
+ nfs_destroy_inodecache();
+out2:
+ nfs_destroy_nfspagecache();
+out3:
+ return err;
}
static void __exit exit_nfs_fs(void)
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]