All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@logfs.org>
To: Doug Gilbert <dgilbert@interlog.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
	linux-scsi@vger.kernel.org
Subject: [PATCH 05/10] sg: remove closed flag
Date: Thu, 12 Apr 2012 17:33:39 -0400	[thread overview]
Message-ID: <20120412213339.GE17388@logfs.org> (raw)
In-Reply-To: <20120412213217.GA17388@logfs.org>

After sg_release() has been called, noone should be able to actually use
that filedescriptor anymore.  So if closed ever made a difference in the
past five years or so, it would have meant a bug.  Remove it.

Signed-off-by: Joern Engel <joern@logfs.org>
---
 drivers/scsi/sg.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 1a0be4f..ba657a9 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -157,7 +157,6 @@ typedef struct sg_fd {		/* holds the state of a file descriptor */
 	Sg_request req_arr[SG_MAX_QUEUE];	/* used as singly-linked list */
 	char low_dma;		/* as in parent but possibly overridden to 1 */
 	char force_packid;	/* 1 -> pack_id input to read(), 0 -> ignored */
-	volatile char closed;	/* 1 -> fd closed but request(s) outstanding */
 	char cmd_q;		/* 1 -> allow command queuing, 0 -> don't */
 	char next_cmd_len;	/* 0 -> automatic (def), >0 -> use on next write() */
 	char keep_orphan;	/* 0 -> drop orphan (def), 1 -> keep for read() */
@@ -329,8 +328,6 @@ sg_release(struct inode *inode, struct file *filp)
 		return -ENXIO;
 	SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name));
 
-	sfp->closed = 1;
-
 	sdp->exclude = 0;
 	wake_up_interruptible(&sdp->o_excl_wait);
 
@@ -1118,8 +1115,7 @@ sg_poll(struct file *filp, poll_table * wait)
 	int count = 0;
 	unsigned long iflags;
 
-	if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))
-	    || sfp->closed)
+	if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
 		return POLLERR;
 	poll_wait(filp, &sfp->read_wait, wait);
 	read_lock_irqsave(&sfp->rq_list_lock, iflags);
@@ -2515,9 +2511,9 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)
 			   fp->reserve.bufflen,
 			   (int) fp->reserve.k_use_sg,
 			   (int) fp->low_dma);
-		seq_printf(s, "   cmd_q=%d f_packid=%d k_orphan=%d closed=%d\n",
+		seq_printf(s, "   cmd_q=%d f_packid=%d k_orphan=%d closed=0\n",
 			   (int) fp->cmd_q, (int) fp->force_packid,
-			   (int) fp->keep_orphan, (int) fp->closed);
+			   (int) fp->keep_orphan);
 		for (m = 0, srp = fp->headrp;
 				srp != NULL;
 				++m, srp = srp->nextrp) {
-- 
1.7.9.1


  parent reply	other threads:[~2012-04-12 23:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 21:32 [PATCH 01/10] sg: remove unnecessary indentation Jörn Engel
2012-04-12 21:32 ` [PATCH 02/10] sg: remove while (1) non-loop Jörn Engel
2012-05-16 21:57   ` Douglas Gilbert
2012-04-12 21:33 ` [PATCH 03/10] " Jörn Engel
2012-05-16 21:57   ` Douglas Gilbert
2012-04-12 21:33 ` [PATCH 04/10] sg: use wait_event_interruptible() Jörn Engel
2012-05-16 21:57   ` Douglas Gilbert
2012-04-12 21:33 ` Jörn Engel [this message]
2012-05-16 21:57   ` [PATCH 05/10] sg: remove closed flag Douglas Gilbert
2012-04-12 21:33 ` [PATCH 06/10] sg: prevent unwoken sleep Jörn Engel
2012-05-16 21:57   ` Douglas Gilbert
2012-04-12 21:34 ` [PATCH 07/10] sg: protect sdp->exclude Jörn Engel
2012-04-23 22:13   ` Douglas Gilbert
2012-04-24 20:13     ` [PATCH v2 " Jörn Engel
2012-05-16 21:57       ` Douglas Gilbert
2012-04-24 20:16     ` [PATCH " Jörn Engel
2012-04-12 21:34 ` [PATCH 08/10] sg: completely protect sfds Jörn Engel
2012-04-25 15:17   ` [PATCH v2 " Jörn Engel
2012-05-16 21:57     ` Douglas Gilbert
2012-04-12 21:35 ` [PATCH 09/10] sg: remove sg_mutex Jörn Engel
2012-05-16 21:57   ` Douglas Gilbert
2012-04-12 21:35 ` [PATCH 10/10] sg: constify sg_proc_leaf_arr Jörn Engel
2012-05-16 21:58   ` Douglas Gilbert
2012-05-07 19:44 ` [PATCH 01/10] sg: remove unnecessary indentation Jörn Engel
2012-05-11 14:43   ` Jörn Engel
2012-05-16 21:57 ` Douglas Gilbert

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=20120412213339.GE17388@logfs.org \
    --to=joern@logfs.org \
    --cc=JBottomley@parallels.com \
    --cc=dgilbert@interlog.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 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.