From patchwork Sun Jan 23 18:18:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hugo-lkml@carfax.org.uk X-Patchwork-Id: 499311 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0NIIdL4013348 for ; Sun, 23 Jan 2011 18:18:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206Ab1AWSSe (ORCPT ); Sun, 23 Jan 2011 13:18:34 -0500 Received: from frost.carfax.org.uk ([212.13.194.111]:1288 "EHLO frost.carfax.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107Ab1AWSSd (ORCPT ); Sun, 23 Jan 2011 13:18:33 -0500 Received: from ruthven.carfax.org.uk ([10.0.0.10]) by frost.carfax.org.uk with esmtp (Exim 4.69) (envelope-from ) id 1Ph4WC-0005Fe-Bd; Sun, 23 Jan 2011 18:18:32 +0000 Received: from hrm by ruthven.carfax.org.uk with local (Exim 4.72) (envelope-from ) id 1Ph4WC-0002oe-15; Sun, 23 Jan 2011 18:18:28 +0000 Date: Sun, 23 Jan 2011 18:18:28 +0000 From: Hugo Mills To: Felix Blanke Cc: linux-btrfs@vger.kernel.org, Hugo Mills Subject: Re: Bug in mkfs.btrfs?! Message-ID: <20110123181827.GF29985@carfax.org.uk> Mail-Followup-To: Hugo Mills , Felix Blanke , linux-btrfs@vger.kernel.org References: <20110122144513.GA2539@scooter> <20110122145222.GB2539@scooter> <20110122151124.GC29985@carfax.org.uk> <20110122155612.GA3664@scooter> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110122155612.GA3664@scooter> X-GPG-Fingerprint: 8C59 86C7 81F3 93FE BB02 DDB1 20AC B3BE 515C 238D X-GPG-Key: 515C238D X-Parrot: It is no more. It has joined the choir invisible. X-IRC-Nicks: darksatanic darkersatanic darkling darkthing User-Agent: Mutt/1.5.20 (2009-06-14) X-frost.carfax.org.uk-Spam-Score: 0.3 (/) X-frost.carfax.org.uk-Spam-Report: Spam detection software, running on the system "spamd3.lon.bitfolk.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, Felix, On Sat, Jan 22, 2011 at 04:56:12PM +0100, Felix Blanke wrote: > It was a simple: > > mkfs.btrfs -L backup -d single /dev/loop2 > > But it also happens without the options, like: > > mkfs.btrfs /dev/loop2 > > > /dev/loop2 is a loop device, which is aes encrypted. The output of "losetup /dev/loop2": > > /dev/loop2: [0010]:5324 > (/dev/disk/by-id/ata-WDC_WD6400AAKS-22A7B2_WD-WCASY7780706-part3) encryption=AES128 > > > Thanks you for looking into this! > While writing this I read your second mail. The strace output is attached. [...] Content analysis details: (0.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.3 PLING_QUERY Subject has exclamation mark and question mark Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 23 Jan 2011 18:18:40 +0000 (UTC) diff --git a/mkfs.c b/mkfs.c index 2e99b95..51a5096 100644 --- a/mkfs.c +++ b/mkfs.c @@ -422,6 +422,7 @@ int main(int ac, char **av) printf("WARNING! - see http://btrfs.wiki.kernel.org before using\n\n"); file = av[optind++]; + printf("Checking whether %s is part of a mounted filesystem\n", file); ret = check_mounted(file); if (ret < 0) { fprintf(stderr, "error checking %s mount status\n", file); diff --git a/utils.c b/utils.c index fd894f3..7fa3149 100644 --- a/utils.c +++ b/utils.c @@ -610,12 +610,16 @@ int resolve_loop_device(const char* loop_dev, char* loop_file, int max_len) int ret_ioctl; struct loop_info loopinfo; + printf("Resolving loop device %s (length %d)\n", loop_dev, max_len); + if ((loop_fd = open(loop_dev, O_RDONLY)) < 0) return -errno; ret_ioctl = ioctl(loop_fd, LOOP_GET_STATUS, &loopinfo); close(loop_fd); + printf("Loop name = %s\n", loopinfo.lo_name); + if (ret_ioctl == 0) strncpy(loop_file, loopinfo.lo_name, max_len); else @@ -639,6 +643,9 @@ int is_same_blk_file(const char* a, const char* b) return -errno; } + printf("Realpath of %s was %s\n", a, real_a); + printf("Realpath of %s was %s\n", b, real_b); + /* Identical path? */ if(strcmp(real_a, real_b) == 0) return 1; @@ -680,6 +687,9 @@ int is_same_loop_file(const char* a, const char* b) const char* final_b; int ret; + printf("is_same_loop_file: %s and %s\n", a, b); + printf("PATH_MAX = %d\n", PATH_MAX); + /* Resolve a if it is a loop device */ if((ret = is_loop_device(a)) < 0) { return ret; @@ -784,8 +794,10 @@ int check_mounted(const char* file) if(strcmp(mnt->mnt_type, "btrfs") != 0) continue; + printf("Testing if btrfs device is in the dev list: %s\n", mnt->mnt_fsname); ret = blk_file_in_dev_list(fs_devices_mnt, mnt->mnt_fsname); } else { + printf("Testing if non-btrfs device is block or regular: %s\n", mnt->mnt_fsname); /* ignore entries in the mount table that are not associated with a file*/ if((ret = is_existing_blk_or_reg_file(mnt->mnt_fsname)) < 0) diff --git a/volumes.c b/volumes.c index 7671855..2496fbd 100644 --- a/volumes.c +++ b/volumes.c @@ -130,6 +130,8 @@ static int device_list_add(const char *path, device->fs_devices = fs_devices; } + printf("Device added with name %s\n", device->name); + if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; fs_devices->latest_trans = found_transid; @@ -223,6 +225,7 @@ int btrfs_scan_one_device(int fd, const char *path, *total_devs = btrfs_super_num_devices(disk_super); uuid_unparse(disk_super->fsid, uuidbuf); + printf("Adding device %s to list\n", path); ret = device_list_add(path, disk_super, devid, fs_devices_ret); error_brelse: