From patchwork Mon Apr 22 22:31:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zach Brown X-Patchwork-Id: 2474011 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 007293FCA5 for ; Mon, 22 Apr 2013 22:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753549Ab3DVWbR (ORCPT ); Mon, 22 Apr 2013 18:31:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34050 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317Ab3DVWbR (ORCPT ); Mon, 22 Apr 2013 18:31:17 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3MMVFlE014745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Apr 2013 18:31:15 -0400 Received: from localhost (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3MMVETe024487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 22 Apr 2013 18:31:14 -0400 Date: Mon, 22 Apr 2013 15:31:14 -0700 From: Zach Brown To: Josef Bacik Cc: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com Subject: Re: [PATCH] xfstests 311: test fsync with dm flakey Message-ID: <20130422223114.GD25389@lenny.home.zabbo.net> References: <1366665213-17894-1-git-send-email-jbacik@fusionio.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1366665213-17894-1-git-send-email-jbacik@fusionio.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org > +static void drop_all_caches() > +{ > + int value = 3; > + int fd; > + > + if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) { > + fprintf(stderr, "Error opening drop caches: %d\n", errno); > + return; > + } > + > + write(fd, &value, sizeof(int)); > + close(fd); > +} fwiw drop_caches takes an ascii string, not a native int: open("/proc/sys/vm/drop_caches", O_WRONLY) = 3 write(3, "\3\0\0\0", 4) = -1 EINVAL (Invalid argument) open("/proc/sys/vm/drop_caches", O_WRONLY) = 3 write(3, "3\n", 2) = 2 and all this makes me think that the write() return should probably have been checked :). - z --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- test.c.busted 2013-04-22 15:22:57.593575545 -0700 +++ test.c 2013-04-22 15:29:25.358072087 -0700 @@ -7,7 +7,7 @@ static void drop_all_caches() { - int value = 3; + char value[] = "3\n"; int fd; if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) { @@ -15,7 +15,7 @@ return; } - write(fd, &value, sizeof(int)); + write(fd, value, sizeof(value) - 1); close(fd); }