summaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/dir.c
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/dir.c
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'fs/ncpfs/dir.c')
-rw-r--r--fs/ncpfs/dir.c64
1 files changed, 38 insertions, 26 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;