All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove read-only/immutable checks from fat_truncate
@ 2004-08-18 14:38 Christoph Hellwig
  2004-08-18 16:06 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2004-08-18 14:38 UTC (permalink / raw)
  To: hirofumi; +Cc: linux-fsdevel

Looking through Herberts bind-mount patches I saw that fat_truncate
checks for the inode beeing read-only or immutable.

This looks wrong to me.  Rationale:

There's two callers:

 - the truncate path via notify_change, ->setattr, vmtruncate.  We
   already check for permissions here at the upper level
 - fat_delete_inode.  This one looks bogus to me - even if we delete
   an read-only or immutable inode we want to free the space allocated
   by it, else you leak disk blocks.


--- 1.25/fs/fat/file.c	2004-05-25 11:53:07 +02:00
+++ edited/fs/fat/file.c	2004-08-18 16:32:42 +02:00
@@ -90,12 +90,6 @@
 	const unsigned int cluster_size = sbi->cluster_size;
 	int nr_clusters;
 
-	/* Why no return value?  Surely the disk could fail... */
-	if (IS_RDONLY (inode))
-		return /* -EPERM */;
-	if (IS_IMMUTABLE(inode))
-		return /* -EPERM */;
-
 	/* 
 	 * This protects against truncating a file bigger than it was then
 	 * trying to write into the hole.

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

* Re: [PATCH] remove read-only/immutable checks from fat_truncate
  2004-08-18 14:38 [PATCH] remove read-only/immutable checks from fat_truncate Christoph Hellwig
@ 2004-08-18 16:06 ` OGAWA Hirofumi
  0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2004-08-18 16:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, Linus Torvalds, Andrew Morton

Christoph Hellwig <hch@lst.de> writes:

> Looking through Herberts bind-mount patches I saw that fat_truncate
> checks for the inode beeing read-only or immutable.
> 
> This looks wrong to me.  Rationale:

Yes.

Looks good to me. Since vfs layer is already checking those flags at
all path, I think those are unneeded.
(open, truncate, unlink, and rmdir)

Please appply the Christoph's patch.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>



Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

There's two callers:

 - the truncate path via notify_change, ->setattr, vmtruncate.  We
   already check for permissions here at the upper level
 - fat_delete_inode.  This one looks bogus to me - even if we delete
   an read-only or immutable inode we want to free the space allocated
   by it, else you leak disk blocks.


--- 1.25/fs/fat/file.c	2004-05-25 11:53:07 +02:00
+++ edited/fs/fat/file.c	2004-08-18 16:32:42 +02:00
@@ -90,12 +90,6 @@
 	const unsigned int cluster_size = sbi->cluster_size;
 	int nr_clusters;
 
-	/* Why no return value?  Surely the disk could fail... */
-	if (IS_RDONLY (inode))
-		return /* -EPERM */;
-	if (IS_IMMUTABLE(inode))
-		return /* -EPERM */;
-
 	/* 
 	 * This protects against truncating a file bigger than it was then
 	 * trying to write into the hole.

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

end of thread, other threads:[~2004-08-18 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-18 14:38 [PATCH] remove read-only/immutable checks from fat_truncate Christoph Hellwig
2004-08-18 16:06 ` OGAWA Hirofumi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.