[PATCH v2 2/2] btrfs: convert snapshot/nocow exlcusion to drw lock

2019-07-19 Thread Nikolay Borisov
This patch removes all haphazard code implementing nocow writers exclusion from pending snapshot creation and switches to using the drw lock to ensure this invariant still holds. "Readers" are snapshot creators from create_snapshot and 'writers' are nocow writers from buffered write path or btrfs_s

[PATCH v2 1/2] btrfs: Implement DRW lock

2019-07-19 Thread Nikolay Borisov
A (D)ouble (R)eader (W)riter lock is a locking primitive that allows to have multiple readers or multiple writers but not multiple readers and writers holding it concurrently. The code is factored out from the existing open-coded locking scheme used to exclude pending snapshots from nocow writers a

[PATCH v2 0/2] Refactor snapshot vs nocow writers locking

2019-07-19 Thread Nikolay Borisov
Hello, Here is the second version of the DRW lock for btrfs. Main changes from v1: * Fixed all checkpatch warnings (Andrea Parri) * Properly call write_unlock in btrfs_drw_try_write_lock (Filipe Manana) * Comment fix. * Stress tested it via locktorture. Survived for 8 straight days on a 4 sock

[RFC PATCH] btrfs: Hook btrfs' DRW lock to locktorture infrastructure

2019-07-19 Thread Nikolay Borisov
Signed-off-by: Nikolay Borisov --- Hello Paul, Here is the code I used to test the DRW lock via the lock torture infrastructure. It's rather ugly but got the job done for me. It's definitely not in a mergeable form. At the very least I think including btrfs headers constitutes a violation of

Re: [PATCH v2 1/4] btrfs: volumes: Unexport find_free_dev_extent_start()

2019-07-19 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnb

Re: [PATCH v2 3/4] btrfs: extent-tree: Add comment for inc_block_group_ro()

2019-07-19 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnb

Re: [PATCH v2 2/4] btrfs: volumes: Add comment for find_free_dev_extent_start()

2019-07-19 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn Btw: this comment block lacks a second '*' at the start to be valid kernel doc -/* +/** * find_free_dev_extent_start - find free space in the specified device -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de

Re: Deadlock between btrfs-transacti and userland on 5.2.1

2019-07-19 Thread Drazen Kacar
I've got more hung tasks. Log is attached. Several empty lines in the file mean that there was a reboot in between. btrfs scrub -Bdr says there are no errors on disks. btrfs device stats also shows no errors.Jul 19 11:47:36 prod-dbsnap-01 systemd: Started PostgreSQL snapshot service for ardcimic

Re: [PATCH] btrfs: ratelimit device path change info on mounted device

2019-07-19 Thread David Sterba
On Tue, Jul 16, 2019 at 09:59:10PM +0800, Anand Jain wrote: > If there are more than one path to a device, the last scanned path > will map to the mounted FS. In some Linux based os there appears to be a > system script (autofs?) which fails to notice that a device's alternative > path is already m

Re: "btrfs: harden agaist duplicate fsid" spams syslog

2019-07-19 Thread David Sterba
On Fri, Jul 12, 2019 at 02:32:10PM +0100, Graham Cobb wrote: > It is weird, because there are other symlinks also pointing to the > device. In my case, lvm sets up both /dev/mapper/cryptdata4tb--vg-backup > and /dev/cryptdata4tb-vg/backup as symlinks to ../dm-13 but only the > first one fights with

[PATCH 2/2] btrfs-progs: receive: don't lookup clone root for received subvolume

2019-07-19 Thread Omar Sandoval
From: Omar Sandoval When we process a clone request, we look up the source subvolume by UUID, even if the source is the subvolume that we're currently receiving. Usually, this is fine. However, if for some reason we previously received the same subvolume, then this will use paths relative to the

[PATCH 0/2] btrfs-progs: fix clone from wrong subvolume

2019-07-19 Thread Omar Sandoval
From: Omar Sandoval Hi, This series is a couple of minor fixes to btrfs receive. Patch 1 fixes a missing strdup() return value check by getting rid of the strdup(). Patch 2 (the more important one) fixes a receive error when the same subvolume is received multiple times. Thanks, Omar Omar Sand

[PATCH 1/2] btrfs-progs: receive: get rid of unnecessary strdup()

2019-07-19 Thread Omar Sandoval
From: Omar Sandoval In process_clone(), we're not checking the return value of strdup(). But, there's no reason to strdup() in the first place: we just pass the path into path_cat_out(). Get rid of the strdup(). Fixes: f1c24cd80dfd ("Btrfs-progs: add btrfs send/receive commands") Signed-off-by:

Re: [PATCH 1/2] btrfs-progs: receive: get rid of unnecessary strdup()

2019-07-19 Thread Omar Sandoval
On Fri, Jul 19, 2019 at 10:40:00PM -0700, Omar Sandoval wrote: > From: Omar Sandoval > > In process_clone(), we're not checking the return value of strdup(). > But, there's no reason to strdup() in the first place: we just pass the > path into path_cat_out(). Get rid of the strdup(). > > Fixes: