linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hpfs: remove ENOSPC hack in unlink
@ 2006-04-20 18:31 Christoph Hellwig
  2006-04-20 18:39 ` Al Viro
  2006-04-22 19:45 ` Mikulas Patocka
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2006-04-20 18:31 UTC (permalink / raw)
  To: mikulas; +Cc: linux-fsdevel

don't try odd hacks on ENOSPC, just fail it.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/hpfs/namei.c
===================================================================
--- linux-2.6.orig/fs/hpfs/namei.c	2006-03-24 20:20:00.000000000 +0100
+++ linux-2.6/fs/hpfs/namei.c	2006-04-20 20:29:07.000000000 +0200
@@ -376,12 +376,10 @@
 	dnode_secno dno;
 	fnode_secno fno;
 	int r;
-	int rep = 0;
 	int err;
 
 	lock_kernel();
 	hpfs_adjust_length((char *)name, &len);
-again:
 	mutex_lock(&hpfs_i(inode)->i_parent_mutex);
 	mutex_lock(&hpfs_i(dir)->i_mutex);
 	err = -ENOENT;
@@ -404,35 +402,9 @@
 		hpfs_error(dir->i_sb, "there was error when removing dirent");
 		err = -EFSERROR;
 		break;
-	case 2:		/* no space for deleting, try to truncate file */
-
+	case 2:		/* no space for deleting */
 		err = -ENOSPC;
-		if (rep++)
-			break;
-
-		mutex_unlock(&hpfs_i(dir)->i_mutex);
-		mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
-		d_drop(dentry);
-		spin_lock(&dentry->d_lock);
-		if (atomic_read(&dentry->d_count) > 1 ||
-		    permission(inode, MAY_WRITE, NULL) ||
-		    !S_ISREG(inode->i_mode) ||
-		    get_write_access(inode)) {
-			spin_unlock(&dentry->d_lock);
-			d_rehash(dentry);
-		} else {
-			struct iattr newattrs;
-			spin_unlock(&dentry->d_lock);
-			/*printk("HPFS: truncating file before delete.\n");*/
-			newattrs.ia_size = 0;
-			newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-			err = notify_change(dentry, &newattrs);
-			put_write_access(inode);
-			if (!err)
-				goto again;
-		}
-		unlock_kernel();
-		return -ENOSPC;
+		break;
 	default:
 		inode->i_nlink--;
 		err = 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hpfs: remove ENOSPC hack in unlink
  2006-04-20 18:31 [PATCH] hpfs: remove ENOSPC hack in unlink Christoph Hellwig
@ 2006-04-20 18:39 ` Al Viro
  2006-04-22 19:45 ` Mikulas Patocka
  1 sibling, 0 replies; 3+ messages in thread
From: Al Viro @ 2006-04-20 18:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: mikulas, linux-fsdevel

On Thu, Apr 20, 2006 at 08:31:49PM +0200, Christoph Hellwig wrote:
> don't try odd hacks on ENOSPC, just fail it.

Care to give any sort of rationale?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hpfs: remove ENOSPC hack in unlink
  2006-04-20 18:31 [PATCH] hpfs: remove ENOSPC hack in unlink Christoph Hellwig
  2006-04-20 18:39 ` Al Viro
@ 2006-04-22 19:45 ` Mikulas Patocka
  1 sibling, 0 replies; 3+ messages in thread
From: Mikulas Patocka @ 2006-04-22 19:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel

> don't try odd hacks on ENOSPC, just fail it.

What's the reason for this patch? Doesn't it work? HPFS is tricky that 
when you delete file there, it may allocate more space (b-trees are 
evil). So it truncates file content first.

Mikulas

> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: linux-2.6/fs/hpfs/namei.c
> ===================================================================
> --- linux-2.6.orig/fs/hpfs/namei.c	2006-03-24 20:20:00.000000000 +0100
> +++ linux-2.6/fs/hpfs/namei.c	2006-04-20 20:29:07.000000000 +0200
> @@ -376,12 +376,10 @@
> 	dnode_secno dno;
> 	fnode_secno fno;
> 	int r;
> -	int rep = 0;
> 	int err;
>
> 	lock_kernel();
> 	hpfs_adjust_length((char *)name, &len);
> -again:
> 	mutex_lock(&hpfs_i(inode)->i_parent_mutex);
> 	mutex_lock(&hpfs_i(dir)->i_mutex);
> 	err = -ENOENT;
> @@ -404,35 +402,9 @@
> 		hpfs_error(dir->i_sb, "there was error when removing dirent");
> 		err = -EFSERROR;
> 		break;
> -	case 2:		/* no space for deleting, try to truncate file */
> -
> +	case 2:		/* no space for deleting */
> 		err = -ENOSPC;
> -		if (rep++)
> -			break;
> -
> -		mutex_unlock(&hpfs_i(dir)->i_mutex);
> -		mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
> -		d_drop(dentry);
> -		spin_lock(&dentry->d_lock);
> -		if (atomic_read(&dentry->d_count) > 1 ||
> -		    permission(inode, MAY_WRITE, NULL) ||
> -		    !S_ISREG(inode->i_mode) ||
> -		    get_write_access(inode)) {
> -			spin_unlock(&dentry->d_lock);
> -			d_rehash(dentry);
> -		} else {
> -			struct iattr newattrs;
> -			spin_unlock(&dentry->d_lock);
> -			/*printk("HPFS: truncating file before delete.\n");*/
> -			newattrs.ia_size = 0;
> -			newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
> -			err = notify_change(dentry, &newattrs);
> -			put_write_access(inode);
> -			if (!err)
> -				goto again;
> -		}
> -		unlock_kernel();
> -		return -ENOSPC;
> +		break;
> 	default:
> 		inode->i_nlink--;
> 		err = 0;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-22 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-20 18:31 [PATCH] hpfs: remove ENOSPC hack in unlink Christoph Hellwig
2006-04-20 18:39 ` Al Viro
2006-04-22 19:45 ` Mikulas Patocka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).