X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.4.0-r929098 Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p97MgScT003288 for ; Fri, 7 Oct 2011 17:42:29 -0500 Received: from xmail.sgi.com (pv-excas3-dc21-nlb.corp.sgi.com [137.38.102.207]) by relay1.corp.sgi.com (Postfix) with ESMTP id AA0F18F8033 for ; Fri, 7 Oct 2011 15:42:28 -0700 (PDT) Received: from [127.0.0.1] (128.162.232.50) by xmail.sgi.com (137.38.102.30) with Microsoft SMTP Server (TLS) id 14.1.289.1; Fri, 7 Oct 2011 17:41:39 -0500 Subject: [Fwd: [PATCH] xfstests: limit OP_PUNCH_HOLE operations to the file size] From: Alex Elder Reply-To: To: Content-Type: text/plain; charset="UTF-8" Date: Fri, 7 Oct 2011 17:41:38 -0500 Message-ID: <1318027298.2810.82.camel@doink> MIME-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit X-Originating-IP: [128.162.232.50] X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean Review? -------- Forwarded Message -------- From: Alex Elder To: xfs@oss.sgi.com Subject: [PATCH] xfstests: limit OP_PUNCH_HOLE operations to the file size Date: Wed, 21 Sep 2011 15:18:06 -0500 Before punching a hole in a file, TRIM_OFF_LEN() calls TRIM_OFF_LEN() in order to make sure the offset and size used are in a reasonable range. But currently the range it's limited to is maxfilelen, which allows the offset (and therefore offset + len) to be beyond EOF. Later, do_punch_hole() ignores any request that starts beyond EOF, so we might as well limit requests to the file size. It appears that a hole punch request that starts within a file but whose length extends beyond it is treated simply as a hole punch up to EOF. So there's no harm in limiting the end of a hole punch request to the file size either. Therefore, use TRIM_OFF_LEN() to put both the the offset and length of a request within the file size for hole punch requests. Signed-off-by: Alex Elder --- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: b/ltp/fsx.c =================================================================== --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1085,7 +1085,7 @@ test(void) break; case OP_PUNCH_HOLE: - TRIM_OFF_LEN(offset, size, maxfilelen); + TRIM_OFF_LEN(offset, size, file_size); do_punch_hole(offset, size); break; default: