patch-2.1.43 linux/fs/sysv/namei.c
Next file: linux/fs/sysv/symlink.c
Previous file: linux/fs/sysv/inode.c
Back to the patch index
Back to the overall index
- Lines: 64
- Date:
Thu Jun 12 16:22:09 1997
- Orig file:
v2.1.42/linux/fs/sysv/namei.c
- Orig date:
Sat Nov 30 02:24:01 1996
diff -u --recursive --new-file v2.1.42/linux/fs/sysv/namei.c linux/fs/sysv/namei.c
@@ -454,7 +454,7 @@
retval = -ENOENT;
goto end_rmdir;
}
- if (inode->i_count > 1) {
+ if (atomic_read(&inode->i_count) > 1) {
retval = -EBUSY;
goto end_rmdir;
}
@@ -635,7 +635,7 @@
int ino;
int result;
- new_inode->i_count++;
+ atomic_inc(&new_inode->i_count);
result = 0;
for (;;) {
if (new_inode == old_inode) {
@@ -668,7 +668,7 @@
* higher-level routines.
*/
static int do_sysv_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)
{
struct inode * old_inode, * new_inode;
struct buffer_head * old_bh, * new_bh, * dir_bh;
@@ -694,8 +694,6 @@
old_inode = __iget(old_dir->i_sb, old_de->inode, 0); /* don't cross mnt-points */
if (!old_inode)
goto end_rename;
- if (must_be_dir && !S_ISDIR(old_inode->i_mode))
- goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
current->fsuid != old_inode->i_uid &&
@@ -724,7 +722,7 @@
if (!empty_dir(new_inode))
goto end_rename;
retval = -EBUSY;
- if (new_inode->i_count > 1)
+ if (atomic_read(&new_inode->i_count) > 1)
goto end_rename;
}
retval = -EPERM;
@@ -810,8 +808,7 @@
* as they are on different partitions.
*/
int sysv_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)
{
static struct wait_queue * wait = NULL;
static int lock = 0;
@@ -821,7 +818,7 @@
sleep_on(&wait);
lock = 1;
result = do_sysv_rename(old_dir, old_name, old_len,
- new_dir, new_name, new_len, must_be_dir);
+ new_dir, new_name, new_len);
lock = 0;
wake_up(&wait);
return result;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov