From patchwork Wed May 21 17:47:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 351272 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4B69A140083 for ; Thu, 22 May 2014 03:47:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751801AbaEURrp (ORCPT ); Wed, 21 May 2014 13:47:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32349 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbaEURro (ORCPT ); Wed, 21 May 2014 13:47:44 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4LHliiv019851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 21 May 2014 13:47:44 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4LHlhju011663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 21 May 2014 13:47:44 -0400 Message-ID: <537CE6C0.1050800@redhat.com> Date: Wed, 21 May 2014 12:47:44 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: ext4 development Subject: [PATCH V2] mke2fs: use ext2fs_open_file() in check_plausibility() References: <537CE3E1.10406@redhat.com> In-Reply-To: <537CE3E1.10406@redhat.com> X-Enigmail-Version: 1.6 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The commit: 802146c mke2fs: create a regular file if necessary caused a regression on 32-bit machines; the open() fails if the file size is > 4G. Using ext2fs_open_file() fixes it. Resolves: Red Hat Bugzilla #1099892 Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong --- V2: against master! Sorry, first patch was against the bisection point. TBH I don't know if this should be using ext2fs_open_file(), or some other magic like O_LARGEFILE, but this works for me, and we use the stat/fstat wrapper here too, so ... -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/misc/util.c b/misc/util.c index 1c0818f..7e91509 100644 --- a/misc/util.c +++ b/misc/util.c @@ -194,10 +194,10 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev) char *fs_type = NULL; char *fs_label = NULL; - fd = open(device, fl, 0666); + fd = ext2fs_open_file(device, fl, 0666); if ((fd < 0) && (errno == ENOENT) && (flags & CREATE_FILE)) { fl |= O_CREAT; - fd = open(device, fl, 0666); + fd = ext2fs_open_file(device, fl, 0666); if (fd >= 0 && (flags & VERBOSE_CREATE)) printf(_("Creating regular file %s\n"), device); }