summaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /fs/ncpfs
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/dir.c64
-rw-r--r--fs/ncpfs/ncplib_kernel.c2
-rw-r--r--fs/ncpfs/sock.c12
3 files changed, 45 insertions, 33 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index caa2dc261..9ef53c41a 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -24,11 +24,6 @@
#include <linux/ncp_fs.h>
#include "ncplib_kernel.h"
-#ifndef shrink_dcache_parent
-#define shrink_dcache_parent(dentry) shrink_dcache_sb((dentry)->d_sb)
-#endif
-
-
struct ncp_dirent {
struct nw_info_struct i;
struct nw_search_sequence s; /* given back for i */
@@ -298,7 +293,8 @@ leave_me:
#ifdef CONFIG_NCPFS_STRONG
static int
ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_name,
- struct inode *new_dir, struct dentry* new_dentry, char *_new_name)
+ struct inode *new_dir, struct dentry* new_dentry, char *_new_name,
+ int *done_flag)
{
int res=0x90,res2;
struct iattr ia;
@@ -321,19 +317,34 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
old_dir, _old_name,
new_dir, _new_name);
+ if (!res) {
+ ncp_invalid_dir_cache(old_dir);
+ ncp_invalid_dir_cache(new_dir);
+ d_move(old_dentry,new_dentry);
+ *done_flag=1;
+
+ if (!old_dentry->d_inode) {
+ DPRINTK(KERN_INFO "ncpfs: no inode -- file remains rw\n");
+ goto leave_me;
+ }
+ if ((res2=ncp_lookup_validate(old_dentry))) {
+ DPRINTK(KERN_DEBUG "ncpfs: ncp_lookup_validate returned %d\n",res2);
+ }
+ }
+
memset(&ia,0,sizeof(struct iattr));
ia.ia_mode = old_dentry->d_inode->i_mode;
ia.ia_mode &= ~(NCP_SERVER(old_dentry->d_inode)->m.file_mode & 0222); /* clear write bits */
ia.ia_valid = ATTR_MODE;
- /* FIXME: uses only inode info, no dentry info... so it is safe to call */
- /* it now with old dentry. If we use name (in future), we have to move */
- /* it after dentry_move in caller */
+ DPRINTK(KERN_INFO "calling ncp_notify_change() with %s/%s\n",
+ old_dentry->d_parent->d_name.name,old_dentry->d_name.name);
+
res2=ncp_notify_change(old_dentry, &ia);
if (res2)
{
printk(KERN_INFO "ncpfs: ncp_notify_change (2) failed: %08x\n",res2);
- goto leave_me;
+ /* goto leave_me; */
}
leave_me:
@@ -755,7 +766,7 @@ static int ncp_lookup(struct inode *dir, struct dentry *dentry)
int len = dentry->d_name.len;
struct ncpfs_inode_info finfo;
__u8 __name[dentry->d_name.len + 1];
-
+
error = -ENOENT;
if (!dir || !S_ISDIR(dir->i_mode)) {
printk(KERN_WARNING "ncp_lookup: inode is NULL or not a directory.\n");
@@ -983,17 +994,14 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
printk(KERN_WARNING "ncp_rmdir: inode is NULL or not a directory\n");
goto out;
}
+
error = -EIO;
if (!ncp_conn_valid(NCP_SERVER(dir)))
goto out;
- if (dentry->d_count > 1)
- {
- shrink_dcache_parent(dentry);
- error = -EBUSY;
- if (dentry->d_count > 1)
- goto out;
- }
+ error = -EBUSY;
+ if (!list_empty(&dentry->d_hash))
+ goto out;
strncpy(_name, dentry->d_name.name, dentry->d_name.len);
_name[dentry->d_name.len] = '\0';
@@ -1007,7 +1015,6 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
if (!result)
{
ncp_invalid_dir_cache(dir);
- d_delete(dentry);
error = 0;
}
out:
@@ -1067,7 +1074,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
{
int old_len = old_dentry->d_name.len;
int new_len = new_dentry->d_name.len;
- int error;
+ int error, done_flag=0;
char _old_name[old_dentry->d_name.len + 1];
char _new_name[new_dentry->d_name.len + 1];
@@ -1105,16 +1112,21 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dir, _new_name);
#ifdef CONFIG_NCPFS_STRONG
if (error == 0x90 && NCP_SERVER(old_dir)->m.flags & NCP_MOUNT_STRONG) { /* RO */
- error = ncp_force_rename(old_dir, old_dentry, _old_name, new_dir, new_dentry, _new_name);
+ error = ncp_force_rename(old_dir, old_dentry, _old_name,
+ new_dir, new_dentry, _new_name,
+ &done_flag);
}
#endif
if (error == 0)
{
- DPRINTK(KERN_DEBUG "ncp renamed %s -> %s.\n",
- old_dentry->d_name.name,new_dentry->d_name.name);
- ncp_invalid_dir_cache(old_dir);
- ncp_invalid_dir_cache(new_dir);
- d_move(old_dentry,new_dentry);
+ if (done_flag == 0) /* if 1, the following already happened */
+ { /* in ncp_force_rename() */
+ DPRINTK(KERN_DEBUG "ncp renamed %s -> %s.\n",
+ old_dentry->d_name.name,new_dentry->d_name.name);
+ ncp_invalid_dir_cache(old_dir);
+ ncp_invalid_dir_cache(new_dir);
+ d_move(old_dentry,new_dentry);
+ }
} else {
if (error == 0x9E)
error = -ENAMETOOLONG;
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
index 34f51d23a..fc0bbf013 100644
--- a/fs/ncpfs/ncplib_kernel.c
+++ b/fs/ncpfs/ncplib_kernel.c
@@ -300,6 +300,7 @@ out:
return result;
}
+#ifdef CONFIG_NCPFS_NFS_NS
static int
ncp_obtain_DOS_dir_base(struct ncp_server *server,
__u8 volnum, __u32 dirent,
@@ -323,6 +324,7 @@ ncp_obtain_DOS_dir_base(struct ncp_server *server,
ncp_unlock_server(server);
return result;
}
+#endif /* CONFIG_NCPFS_NFS_NS */
static inline int
ncp_get_known_namespace(struct ncp_server *server, __u8 volume)
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c
index ea15ae968..cdcfc4220 100644
--- a/fs/ncpfs/sock.c
+++ b/fs/ncpfs/sock.c
@@ -94,7 +94,7 @@ static int do_ncp_rpc_call(struct ncp_server *server, int size)
poll_table wait_table;
struct poll_table_entry entry;
int init_timeout, max_timeout;
- int timeout;
+ int timeout; long tmp_timeout;
int retrans;
int major_timeout_seen;
int acknowledge_seen;
@@ -173,6 +173,7 @@ static int do_ncp_rpc_call(struct ncp_server *server, int size)
wait_table.entry = &entry;
current->state = TASK_INTERRUPTIBLE;
if (!(file->f_op->poll(file, &wait_table) & POLLIN)) {
+ int timed_out;
if (timeout > max_timeout) {
/* JEJB/JSP 2/7/94
* This is useful to see if the system is
@@ -182,17 +183,15 @@ static int do_ncp_rpc_call(struct ncp_server *server, int size)
}
timeout = max_timeout;
}
- current->timeout = jiffies + timeout;
- schedule();
+ timed_out = !schedule_timeout(timeout);
remove_wait_queue(entry.wait_address, &entry.wait);
fput(file);
current->state = TASK_RUNNING;
if (signal_pending(current)) {
- current->timeout = 0;
result = -ERESTARTSYS;
break;
}
- if (!current->timeout) {
+ if (timed_out) {
if (n < retrans)
continue;
if (server->m.flags & NCP_MOUNT_SOFT) {
@@ -208,8 +207,7 @@ static int do_ncp_rpc_call(struct ncp_server *server, int size)
}
major_timeout_seen = 1;
continue;
- } else
- current->timeout = 0;
+ }
} else if (wait_table.nr) {
remove_wait_queue(entry.wait_address, &entry.wait);
fput(file);