[stgt] [PATCH] 1/1 Correct fsync on write FILEMARKS

Mark Harvey markh794 at gmail.com
Thu Feb 9 22:30:50 CET 2012


 From 823564e4f3fc36a7c7fed4535541c57aa4552f13 Mon Sep 17 00:00:00 2001
From: Mark Harvey<markh794 at gmail.com>
Date: Fri, 27 Jan 2012 08:32:05 +1100
Subject: ssc: fsync on WRITE FILEMARK

commit: 96e83a2e60857cd5356f99c45f0a0a658f600949
  missed fsync() on zero filemarks count.

SSC4r01e states:
   NOTE 43 - Upon completion of any buffered write operation, the application
	client may issue a WRITE FILEMARKS(6) command with the IMMED bit set
	to zero and the FILEMARK COUNT field set to zero to perform a
	synchronize operation

   The IMMED bit is defined as:
	a) written to the object buffer if the IMMED bit is set to one; or
	b) written to the medium if the IMMED bit is set to zero.

This patch calls fsync() ignoring the IMMED bit value.

Signed-off-by: Mark Harvey<markh794 at gmail.com>
---
  usr/bs_ssc.c |    4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c
index f21509c..4efc482 100644
--- a/usr/bs_ssc.c
+++ b/usr/bs_ssc.c
@@ -189,9 +189,6 @@ static int append_blk(struct scsi_cmd *cmd, uint8_t *data,
  	}
  	/* Write new EOD blk header */

-	if (type == BLK_FILEMARK)
-		fsync(fd);
-
  	return SAM_STAT_GOOD;
  }

@@ -466,6 +463,7 @@ static void tape_rdwr_request(struct scsi_cmd *cmd)
  			append_blk(cmd, scsi_get_out_buffer(cmd), 0,
  					0, BLK_FILEMARK);

+		fsync(cmd->dev->fd);
  		break;

  	case READ_6:
-- 
1.7.4.1



--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list