mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@in.ibm.com>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [patch 1/4] Cleanup file_count usage: Bad usage at some .open, .release
Date: Tue, 16 Nov 2004 19:27:52 +0530	[thread overview]
Message-ID: <20041116135752.GB23257@impedimenta.in.ibm.com> (raw)
In-Reply-To: <20041116135200.GA23257@impedimenta.in.ibm.com>

Following patch cleans up some obviously wrong usage of struct file.f_count
in ->open() and ->release() routines of some file systems, the use case being
check if f_count is 1 in ->open() and f_count is 0 in ->release().  
This patch cleans up the f_count usage for affs, hfs and hfsplus file systems.

Signed-off-by: Ravikiran Thirumalai <kiran@in.ibm.com>
---

 affs/file.c     |    4 ----
 hfs/inode.c     |    4 ----
 hfsplus/inode.c |    4 ----
 3 files changed, 12 deletions(-)


diff -ruN -X dontdiff linux-2.6.9/fs/affs/file.c f_count-2.6.9/fs/affs/file.c
--- linux-2.6.9/fs/affs/file.c	2004-10-19 03:24:08.000000000 +0530
+++ f_count-2.6.9/fs/affs/file.c	2004-11-09 17:45:19.000000000 +0530
@@ -62,8 +62,6 @@
 static int
 affs_file_open(struct inode *inode, struct file *filp)
 {
-	if (atomic_read(&filp->f_count) != 1)
-		return 0;
 	pr_debug("AFFS: open(%d)\n", AFFS_I(inode)->i_opencnt);
 	AFFS_I(inode)->i_opencnt++;
 	return 0;
@@ -72,8 +70,6 @@
 static int
 affs_file_release(struct inode *inode, struct file *filp)
 {
-	if (atomic_read(&filp->f_count) != 0)
-		return 0;
 	pr_debug("AFFS: release(%d)\n", AFFS_I(inode)->i_opencnt);
 	AFFS_I(inode)->i_opencnt--;
 	if (!AFFS_I(inode)->i_opencnt)
diff -ruN -X dontdiff linux-2.6.9/fs/hfs/inode.c f_count-2.6.9/fs/hfs/inode.c
--- linux-2.6.9/fs/hfs/inode.c	2004-10-19 03:25:29.000000000 +0530
+++ f_count-2.6.9/fs/hfs/inode.c	2004-11-09 17:45:19.000000000 +0530
@@ -524,8 +524,6 @@
 {
 	if (HFS_IS_RSRC(inode))
 		inode = HFS_I(inode)->rsrc_inode;
-	if (atomic_read(&file->f_count) != 1)
-		return 0;
 	atomic_inc(&HFS_I(inode)->opencnt);
 	return 0;
 }
@@ -536,8 +534,6 @@
 
 	if (HFS_IS_RSRC(inode))
 		inode = HFS_I(inode)->rsrc_inode;
-	if (atomic_read(&file->f_count) != 0)
-		return 0;
 	if (atomic_dec_and_test(&HFS_I(inode)->opencnt)) {
 		down(&inode->i_sem);
 		hfs_file_truncate(inode);
diff -ruN -X dontdiff linux-2.6.9/fs/hfsplus/inode.c f_count-2.6.9/fs/hfsplus/inode.c
--- linux-2.6.9/fs/hfsplus/inode.c	2004-10-19 03:23:44.000000000 +0530
+++ f_count-2.6.9/fs/hfsplus/inode.c	2004-11-09 17:45:19.000000000 +0530
@@ -268,8 +268,6 @@
 {
 	if (HFSPLUS_IS_RSRC(inode))
 		inode = HFSPLUS_I(inode).rsrc_inode;
-	if (atomic_read(&file->f_count) != 1)
-		return 0;
 	atomic_inc(&HFSPLUS_I(inode).opencnt);
 	return 0;
 }
@@ -280,8 +278,6 @@
 
 	if (HFSPLUS_IS_RSRC(inode))
 		inode = HFSPLUS_I(inode).rsrc_inode;
-	if (atomic_read(&file->f_count) != 0)
-		return 0;
 	if (atomic_dec_and_test(&HFSPLUS_I(inode).opencnt)) {
 		down(&inode->i_sem);
 		hfsplus_file_truncate(inode);

  reply	other threads:[~2004-11-16 14:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 13:52 [patch 0/4] Cleanup file_count usage Ravikiran G Thirumalai
2004-11-16 13:57 ` Ravikiran G Thirumalai [this message]
2004-11-16 14:03 ` [patch 2/4] Cleanup file_count usage: Error/debug messages on f_count reads Ravikiran G Thirumalai
2004-11-16 14:06 ` [patch 3/4] Cleanup file_count usage: Redundant check based on file_count Ravikiran G Thirumalai
2004-11-16 14:11 ` [patch 4/4] Cleanup file_count usage: Avoid file_count usage for hugetlb nattach reporting Ravikiran G Thirumalai
2004-11-16 14:24   ` William Lee Irwin III
2004-11-16 22:31 ` [patch 0/4] Cleanup file_count usage Paul Mackerras
2004-11-17 16:50   ` Ravikiran G Thirumalai
2004-11-17 22:07     ` Paul Mackerras
2004-12-01  6:30       ` Ravikiran G Thirumalai
2004-11-16 22:56 ` Jan Harkes
2004-11-16 23:19   ` Jan Harkes
2004-11-17  0:57 ` Willem Riede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041116135752.GB23257@impedimenta.in.ibm.com \
    --to=kiran@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®