summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c23
-rw-r--r--fs/nfs/file.c3
-rw-r--r--fs/nfs/inode.c8
-rw-r--r--fs/nfs/nfsroot.c15
-rw-r--r--fs/nfs/proc.c4
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/symlink.c56
-rw-r--r--fs/nfs/write.c6
8 files changed, 36 insertions, 81 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a11b9fb6a..71835c255 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -51,7 +51,7 @@ static int nfs_symlink(struct inode *, const char *, int, const char *);
static int nfs_link(struct inode *, struct inode *, const char *, int);
static int nfs_mknod(struct inode *, const char *, int, int, int);
static int nfs_rename(struct inode *, const char *, int,
- struct inode *, const char *, int, int);
+ struct inode *, const char *, int);
static struct file_operations nfs_dir_operations = {
NULL, /* lseek - default */
@@ -78,7 +78,6 @@ struct inode_operations nfs_dir_inode_operations = {
nfs_mknod, /* mknod */
nfs_rename, /* rename */
NULL, /* readlink */
- NULL, /* follow_link */
NULL, /* readpage */
NULL, /* writepage */
NULL, /* bmap */
@@ -351,7 +350,7 @@ static struct nfs_lookup_cache_entry {
char filename[NFS_MAXNAMLEN + 1];
struct nfs_fh fhandle;
struct nfs_fattr fattr;
- int expiration_date;
+ unsigned long expiration_date;
} nfs_lookup_cache[NFS_LOOKUP_CACHE_SIZE];
static struct nfs_lookup_cache_entry *nfs_lookup_cache_index(struct inode *dir,
@@ -492,7 +491,7 @@ static int nfs_lookup(struct inode *dir, const char *__name, int len,
}
memcpy(name,__name,len);
name[len] = '\0';
- if (len == 1 && name[0] == '.') { /* cheat for "." */
+ if (len == 0 || (len == 1 && name[0] == '.')) { /* cheat for "" and "." */
*result = dir;
return 0;
}
@@ -649,11 +648,11 @@ static int nfs_sillyrename(struct inode *dir, const char *name, int len)
char silly[16];
int slen, ret;
- dir->i_count++;
+ atomic_inc(&dir->i_count);
if (nfs_lookup(dir, name, len, &inode) < 0)
return -EIO; /* arbitrary */
- if (inode->i_count == 1) {
+ if (atomic_read(&inode->i_count) == 1) {
iput(inode);
return -EIO;
}
@@ -679,7 +678,7 @@ static int nfs_sillyrename(struct inode *dir, const char *name, int len)
nfs_lookup_cache_remove(dir, NULL, name);
nfs_lookup_cache_remove(dir, NULL, silly);
NFS_RENAMED_DIR(inode) = dir;
- dir->i_count++;
+ atomic_inc(&dir->i_count);
}
nfs_invalidate_dircache(dir);
iput(inode);
@@ -823,8 +822,7 @@ static int nfs_link(struct inode *oldinode, struct inode *dir,
* file in old_dir will go away when the last process iput()s the inode.
*/
static int nfs_rename(struct inode *old_dir, const char *old_name, int old_len,
- struct inode *new_dir, const char *new_name, int new_len,
- int must_be_dir)
+ struct inode *new_dir, const char *new_name, int new_len)
{
int error;
@@ -850,10 +848,6 @@ static int nfs_rename(struct inode *old_dir, const char *old_name, int old_len,
return -ENAMETOOLONG;
}
- /* We don't do rename() with trailing slashes over NFS now. Hmm. */
- if (must_be_dir)
- return -EINVAL;
-
error = nfs_proc_rename(NFS_SERVER(old_dir),
NFS_FH(old_dir), old_name,
NFS_FH(new_dir), new_name);
@@ -879,7 +873,8 @@ void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
int was_empty;
dfprintk(VFS, "NFS: refresh_inode(%x/%ld ct=%d)\n",
- inode->i_dev, inode->i_ino, inode->i_count);
+ inode->i_dev, inode->i_ino,
+ atomic_read(&inode->i_count));
if (!inode || !fattr) {
printk("nfs_refresh_inode: inode or fattr is NULL\n");
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index ca42719bd..56540bbdc 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -69,7 +69,6 @@ struct inode_operations nfs_file_inode_operations = {
NULL, /* mknod */
NULL, /* rename */
NULL, /* readlink */
- NULL, /* follow_link */
nfs_readpage, /* readpage */
nfs_writepage, /* writepage */
NULL, /* bmap */
@@ -143,7 +142,7 @@ nfs_file_write(struct inode *inode, struct file *file,
int result;
dfprintk(VFS, "nfs: write(%x/%ld (%d), %lu@%lu)\n",
- inode->i_dev, inode->i_ino, inode->i_count,
+ inode->i_dev, inode->i_ino, atomic_read(&inode->i_count),
count, (unsigned long) file->f_pos);
if (!inode) {
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7f883270a..5ab9600e9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -316,7 +316,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fhandle,
nfs_refresh_inode(inode, fattr);
}
dprintk("NFS: fhget(%x/%ld ct=%d)\n",
- inode->i_dev, inode->i_ino, inode->i_count);
+ inode->i_dev, inode->i_ino,
+ atomic_read(&inode->i_count));
return inode;
}
@@ -433,7 +434,10 @@ done:
* File system information
*/
static struct file_system_type nfs_fs_type = {
- nfs_read_super, "nfs", 0, NULL
+ "nfs",
+ FS_NO_DCACHE,
+ nfs_read_super,
+ NULL
};
/*
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 66070efd7..add3309f3 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -1,5 +1,5 @@
/*
- * $Id: nfsroot.c,v 1.36 1997/05/27 15:57:47 mj Exp $
+ * $Id: nfsroot.c,v 1.37 1997/06/04 08:28:10 davem Exp $
*
* Copyright (C) 1995, 1996 Gero Kuhlmann <gero@gkminix.han.de>
*
@@ -78,6 +78,7 @@
#include <asm/param.h>
#include <linux/utsname.h>
+#include <linux/nametrans.h>
#include <linux/in.h>
#include <linux/if.h>
#include <linux/inet.h>
@@ -832,6 +833,9 @@ __initfunc(static void root_do_bootp_ext(u8 *ext))
root_bootp_string(nfs_path, ext+1, *ext, NFS_MAXPATHLEN);
break;
}
+#ifdef CONFIG_TRANS_NAMES
+ translations_dirty = 1;
+#endif
}
@@ -1254,6 +1258,9 @@ __initfunc(static void root_nfs_addrs(char *addrs))
system_utsname.domainname[0] = '\0';
user_dev_name[0] = '\0';
bootp_flag = rarp_flag = 1;
+#ifdef CONFIG_TRANS_NAMES
+ translations_dirty = 1;
+#endif
/* The following is just a shortcut for automatic IP configuration */
if (!strcmp(addrs, "bootp")) {
@@ -1299,6 +1306,9 @@ __initfunc(static void root_nfs_addrs(char *addrs))
}
strncpy(system_utsname.nodename, ip, __NEW_UTS_LEN);
system_utsname.nodename[__NEW_UTS_LEN] = '\0';
+#ifdef CONFIG_TRANS_NAMES
+ translations_dirty = 1;
+#endif
break;
case 5:
strncpy(user_dev_name, ip, IFNAMSIZ);
@@ -1332,6 +1342,9 @@ __initfunc(static int root_nfs_setup(void))
if (!system_utsname.nodename[0]) {
strncpy(system_utsname.nodename, in_ntoa(myaddr), __NEW_UTS_LEN);
system_utsname.nodename[__NEW_UTS_LEN] = '\0';
+#ifdef CONFIG_TRANS_NAMES
+ translations_dirty = 1;
+#endif
}
/* Set the correct netmask */
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 714101bb7..58dcd95d0 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -177,8 +177,8 @@ nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, const char *name)
int
nfs_proc_rename(struct nfs_server *server,
- struct nfs_fh *old_dir, const char *old_name,
- struct nfs_fh *new_dir, const char *new_name)
+ struct nfs_fh *old_dir, const char *old_name,
+ struct nfs_fh *new_dir, const char *new_name)
{
struct nfs_renameargs arg = { old_dir, old_name, new_dir, new_name };
int status;
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index cf7c5ece7..2c3b59036 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -188,7 +188,7 @@ nfs_readpage_async(struct inode *inode, struct page *page)
nfs_readpage_result, req);
if (result >= 0) {
- inode->i_count++;
+ atomic_inc(&inode->i_count);
atomic_inc(&page->count);
return 0;
}
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 7ea2d6f99..a22f96239 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -19,8 +19,6 @@
#include <asm/uaccess.h>
static int nfs_readlink(struct inode *, char *, int);
-static int nfs_follow_link(struct inode *, struct inode *, int, int,
- struct inode **);
/*
* symlinks can't do much...
@@ -37,7 +35,6 @@ struct inode_operations nfs_symlink_inode_operations = {
NULL, /* mknod */
NULL, /* rename */
nfs_readlink, /* readlink */
- nfs_follow_link, /* follow_link */
NULL, /* readpage */
NULL, /* writepage */
NULL, /* bmap */
@@ -45,55 +42,6 @@ struct inode_operations nfs_symlink_inode_operations = {
NULL /* permission */
};
-static int nfs_follow_link(struct inode *dir, struct inode *inode,
- int flag, int mode, struct inode **res_inode)
-{
- int error;
- unsigned int len;
- char *res, *res2;
- void *mem;
-
- *res_inode = NULL;
- if (!dir) {
- dir = current->fs->root;
- dir->i_count++;
- }
- if (!inode) {
- iput(dir);
- return -ENOENT;
- }
- if (!S_ISLNK(inode->i_mode)) {
- iput(dir);
- *res_inode = inode;
- return 0;
- }
- if (current->link_count > 5) {
- iput(inode);
- iput(dir);
- return -ELOOP;
- }
- error = nfs_proc_readlink(NFS_SERVER(inode), NFS_FH(inode), &mem,
- &res, &len, NFS_MAXPATHLEN);
- if (error) {
- iput(inode);
- iput(dir);
- kfree(mem);
- return error;
- }
- while ((res2 = (char *) kmalloc(NFS_MAXPATHLEN + 1, GFP_NFS)) == NULL) {
- schedule();
- }
- memcpy(res2, res, len);
- res2[len] = '\0';
- kfree(mem);
- iput(inode);
- current->link_count++;
- error = open_namei(res2, flag, mode, res_inode, dir);
- current->link_count--;
- kfree_s(res2, NFS_MAXPATHLEN + 1);
- return error;
-}
-
static int nfs_readlink(struct inode *inode, char *buffer, int buflen)
{
int error;
@@ -103,10 +51,6 @@ static int nfs_readlink(struct inode *inode, char *buffer, int buflen)
dfprintk(VFS, "nfs: readlink(%x/%ld)\n", inode->i_dev, inode->i_ino);
- if (!S_ISLNK(inode->i_mode)) {
- iput(inode);
- return -EINVAL;
- }
if (buflen > NFS_MAXPATHLEN)
buflen = NFS_MAXPATHLEN;
error = nfs_proc_readlink(NFS_SERVER(inode), NFS_FH(inode), &mem,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 4e2de9cfc..f27d083e4 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -133,7 +133,7 @@ nfs_unlock_page(struct page *page)
if (test_and_clear_bit(PG_decr_after, &page->flags))
atomic_dec(&page->count);
if (test_and_clear_bit(PG_swap_unlock_after, &page->flags))
- swap_after_unlock_page(page->swap_unlock_entry);
+ swap_after_unlock_page(page->pg_swap_entry);
#endif
}
@@ -338,7 +338,7 @@ create_write_request(struct inode *inode, struct page *page,
wreq->wb_page = page;
wreq->wb_offset = offset;
wreq->wb_bytes = bytes;
- inode->i_count++;
+ atomic_inc(&inode->i_count);
atomic_inc(&page->count);
append_write_request(&NFS_WRITEBACK(inode), wreq);
@@ -788,7 +788,7 @@ nfs_wback_result(struct rpc_task *task)
dprintk("NFS: %4d saving write failure code\n",
task->tk_pid);
append_write_request(&nfs_failed_requests, req);
- inode->i_count++;
+ atomic_inc(&inode->i_count);
}
clear_bit(PG_uptodate, &page->flags);
} else if (!WB_CANCELLED(req)) {