linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC] fix reservation discarding in affs
@ 2004-12-12 13:45 Christoph Hellwig
  2005-02-10 10:39 ` Christoph Hellwig
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2004-12-12 13:45 UTC (permalink / raw)
  To: zippel; +Cc: linux-fsdevel

Currently affs discards preallocations in every ->put_inode but we
really want to do this in

 a) ->release when a filedescriptor is closed and
 b) in ->clear_inode to avoid leaking reservations for shared writeable
    mappings

affs already does it in a) and a few other places, so adding it to
affs_clear_inode should make it behave fine.   Also move the truncate
from affs_put_inode with the racy i_count check to affs_clear_inode.
This also avoids the need to take the inode semaphore as the inode can't
be accessed from other threads anymore.


--- 1.21/fs/affs/inode.c	2004-09-17 08:58:42 +02:00
+++ edited/fs/affs/inode.c	2004-12-10 20:21:40 +01:00
@@ -258,19 +258,6 @@
 }
 
 void
-affs_put_inode(struct inode *inode)
-{
-	pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
-	affs_free_prealloc(inode);
-	if (atomic_read(&inode->i_count) == 1) {
-		down(&inode->i_sem);
-		if (inode->i_size != AFFS_I(inode)->mmu_private)
-			affs_truncate(inode);
-		up(&inode->i_sem);
-	}
-}
-
-void
 affs_delete_inode(struct inode *inode)
 {
 	pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
@@ -287,6 +274,12 @@
 	unsigned long cache_page = (unsigned long) AFFS_I(inode)->i_lc;
 
 	pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
+
+	affs_free_prealloc(inode);
+
+	if (inode->i_size != AFFS_I(inode)->mmu_private)
+		affs_truncate(inode);
+
 	if (cache_page) {
 		pr_debug("AFFS: freeing ext cache\n");
 		AFFS_I(inode)->i_lc = NULL;
===== fs/affs/super.c 1.46 vs edited =====
--- 1.46/fs/affs/super.c	2004-09-04 05:11:01 +02:00
+++ edited/fs/affs/super.c	2004-12-10 20:19:18 +01:00
@@ -133,7 +133,6 @@
 	.destroy_inode	= affs_destroy_inode,
 	.read_inode	= affs_read_inode,
 	.write_inode	= affs_write_inode,
-	.put_inode	= affs_put_inode,
 	.delete_inode	= affs_delete_inode,
 	.clear_inode	= affs_clear_inode,
 	.put_super	= affs_put_super,
--- 1.9/include/linux/affs_fs.h	2004-09-17 08:58:43 +02:00
+++ edited/include/linux/affs_fs.h	2004-12-10 20:19:12 +01:00
@@ -58,7 +58,6 @@
 extern unsigned long		 affs_parent_ino(struct inode *dir);
 extern struct inode		*affs_new_inode(struct inode *dir);
 extern int			 affs_notify_change(struct dentry *dentry, struct iattr *attr);
-extern void			 affs_put_inode(struct inode *inode);
 extern void			 affs_delete_inode(struct inode *inode);
 extern void			 affs_clear_inode(struct inode *inode);
 extern void			 affs_read_inode(struct inode *inode);

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

end of thread, other threads:[~2008-05-01 16:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-12 13:45 [PATCH][RFC] fix reservation discarding in affs Christoph Hellwig
2005-02-10 10:39 ` Christoph Hellwig
2005-02-10 12:57   ` Roman Zippel
2008-01-10 15:12     ` Christoph Hellwig
2008-01-14  3:53       ` Roman Zippel
2008-02-07  5:41         ` Christoph Hellwig
2008-02-10 23:47           ` Roman Zippel
2008-04-29 15:02             ` Christoph Hellwig
2008-04-29 15:46               ` [PATCH] kill ->put_inode Christoph Hellwig
2008-05-01 10:04               ` [PATCH][RFC] fix reservation discarding in affs Andrew Morton
2008-05-01 16:05                 ` Roman Zippel

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).