From 53b3988d474435254a3b053a68bb24ce9e439295 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 15 Jun 2000 01:55:58 +0000 Subject: Merge with 2.3.99-pre9. --- fs/smbfs/dir.c | 13 +++++-------- fs/smbfs/file.c | 23 ++--------------------- fs/smbfs/proc.c | 45 --------------------------------------------- 3 files changed, 7 insertions(+), 74 deletions(-) (limited to 'fs/smbfs') diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index a29e55c7a..b5715b220 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c @@ -168,7 +168,7 @@ file->f_dentry->d_name.name); static int smb_lookup_validate(struct dentry *, int); static int smb_hash_dentry(struct dentry *, struct qstr *); static int smb_compare_dentry(struct dentry *, struct qstr *, struct qstr *); -static void smb_delete_dentry(struct dentry *); +static int smb_delete_dentry(struct dentry *); static struct dentry_operations smbfs_dentry_operations = { @@ -259,9 +259,9 @@ out: /* * This is the callback from dput() when d_count is going to 0. - * We use this to unhash dentries with bad inodes and close files. + * We use this to unhash dentries with bad inodes. */ -static void +static int smb_delete_dentry(struct dentry * dentry) { if (dentry->d_inode) @@ -272,13 +272,13 @@ smb_delete_dentry(struct dentry * dentry) printk("smb_delete_dentry: bad inode, unhashing %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name); #endif - d_drop(dentry); + return 1; } - smb_close_dentry(dentry); } else { /* N.B. Unhash negative dentries? */ } + return 0; } /* @@ -466,10 +466,7 @@ smb_unlink(struct inode *dir, struct dentry *dentry) smb_invalid_dir_cache(dir); error = smb_proc_unlink(dentry); if (!error) - { smb_renew_times(dentry); - d_delete(dentry); - } return error; } diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index 61f50bdff..b47e236b0 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c @@ -26,12 +26,6 @@ /* #define SMBFS_DEBUG_VERBOSE 1 */ /* #define pr_debug printk */ -static inline int -min(int a, int b) -{ - return a < b ? a : b; -} - static int smb_fsync(struct file *file, struct dentry * dentry) { @@ -340,28 +334,15 @@ out: static int smb_file_open(struct inode *inode, struct file * file) { -#ifdef SMBFS_DEBUG_VERBOSE -printk("smb_file_open: opening %s/%s, d_count=%d\n", -file->f_dentry->d_parent->d_name.name, file->f_dentry->d_name.name, -file->f_dentry->d_count); -#endif + inode->u.smbfs_i.openers++; return 0; } static int smb_file_release(struct inode *inode, struct file * file) { - struct dentry * dentry = file->f_dentry; - -#ifdef SMBFS_DEBUG_VERBOSE -printk("smb_file_release: closing %s/%s, d_count=%d\n", -dentry->d_parent->d_name.name, dentry->d_name.name, dentry->d_count); -#endif - - if (dentry->d_count == 1) - { + if (!--inode->u.smbfs_i.openers) smb_close(inode); - } return 0; } diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index 06cd5dda9..669deb0d7 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c @@ -818,11 +818,6 @@ smb_open(struct dentry *dentry, int wish) goto out; } - /* - * Note: If the caller holds an active dentry and the file is - * currently open, we can be sure that the file isn't about - * to be closed. (See smb_close_dentry() below.) - */ if (!smb_is_open(inode)) { struct smb_sb_info *server = SMB_SERVER(inode); @@ -943,46 +938,6 @@ smb_close(struct inode *ino) return result; } -/* - * This routine is called from dput() when d_count is going to 0. - * We use this to close the file so that cached dentries don't - * keep too many files open. - * - * There are some tricky race conditions here: the dentry may go - * back into use while we're closing the file, and we don't want - * the new user to be confused as to the open status. - */ -void -smb_close_dentry(struct dentry * dentry) -{ - struct inode *ino = dentry->d_inode; - - if (ino) - { - if (smb_is_open(ino)) - { - struct smb_sb_info *server = SMB_SERVER(ino); - smb_lock_server(server); - /* - * Check whether the dentry is back in use. - */ - if (dentry->d_count <= 1) - { -#ifdef SMBFS_DEBUG_VERBOSE -printk("smb_close_dentry: closing %s/%s, count=%d\n", - DENTRY_PATH(dentry), dentry->d_count); -#endif - smb_proc_close_inode(server, ino); - } - smb_unlock_server(server); - } -#ifdef SMBFS_DEBUG_VERBOSE -printk("smb_close_dentry: closed %s/%s, count=%d\n", - DENTRY_PATH(dentry), dentry->d_count); -#endif - } -} - /* * This is used to close a file following a failed instantiate. * Since we don't have an inode, we can't use any of the above. -- cgit v1.2.3