linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org, David Teigland <teigland@redhat.com>
Subject: Re: dm-writecache issue
Date: Tue, 18 Sep 2018 22:32:38 +1000	[thread overview]
Message-ID: <20180918123238.GI27618@dastard> (raw)
In-Reply-To: <alpine.LRH.2.02.1809180741001.6599@file01.intranet.prod.int.rdu2.redhat.com>

On Tue, Sep 18, 2018 at 07:46:47AM -0400, Mikulas Patocka wrote:
> I would ask the XFS developers about this - why does mkfs.xfs select 
> sector size 512 by default?

Because the underlying device told it that it supported a
sector size of 512 bytes?

> If a filesystem created with the default 512-byte sector size is activated 
> on a device with 4k sectors, it results in mount failure.

Yes, it does, but mkfs should also fail when it tries to write 512
byte sectors to a 4k device, too.

> On Tue, 11 Sep 2018, David Teigland wrote:
> 
> > Hi Mikulas,
> > 
> > Am I doing something wrong below or is there a bug somewhere?  (I could be
> > doing something wrong in the lvm activation code, also.)
> > Thanks
> > 
> > 
> > [root@null-05 ~]# lvs foo
> >   LV   VG  Attr       LSize   
> >   fast foo -wi-------  32.00m
> >   main foo -wi------- 200.00m
> > 
> > [root@null-05 ~]# lvchange -ay foo/main
> > 
> > [root@null-05 ~]# mkfs.xfs /dev/foo/main
> > meta-data=/dev/foo/main          isize=512    agcount=4, agsize=12800 blks
> >          =                       sectsz=512   attr=2, projid32bit=1
> >          =                       crc=1        finobt=0, sparse=0
> > data     =                       bsize=4096   blocks=51200, imaxpct=25
> >          =                       sunit=0      swidth=0 blks
> > naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
> > log      =internal log           bsize=4096   blocks=855, version=2
> >          =                       sectsz=512   sunit=0 blks, lazy-count=1
> > realtime =none                   extsz=4096   blocks=0, rtextents=0
> > 
> > [root@null-05 ~]# mount /dev/foo/main /mnt
> > [root@null-05 ~]# cp /root/pattern* /mnt/
> > [root@null-05 ~]# umount /mnt
> > [root@null-05 ~]# lvchange -an foo/main
> > 
> > [root@null-05 ~]# lvconvert --type writecache --cachepool fast foo/main
> >   Logical volume foo/main now has write cache.
> > 
> > [root@null-05 ~]# lvs -a foo -o+devices
> >   LV            VG  Attr       LSize   Origin        Devices       
> >   [fast]        foo -wi-------  32.00m               /dev/pmem0(0) 
> >   main          foo Cwi------- 200.00m [main_wcorig] main_wcorig(0)
> >   [main_wcorig] foo -wi------- 200.00m               /dev/loop0(0) 

Yeehaw!

I'm betting that the underlying device advertised a logical/physical
sector size of 512 bytes to mkfs, and then adding pmem as the cache
device changed the logical volume from a 512 byte sector device to a
hard 4k sector device.

If so, this is a dm-cache bug. Filesystems don't support changing
the logical/physical sector sizes of the block device dynamically.
Filesystems lay out the filesystem structure at mkfs time based on
the assumption that the sector size of the block device is fixed and
will never change for the life of that filesystem.

Indeed, if the sector size of the block device is not fixed and can
change dynamically, then the block device also violates the
assumptions that the filesystem journalling algorithms make about
the atomic write size of the underlying device....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-09-18 18:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180911221147.GA23308@redhat.com>
2018-09-18 11:46 ` dm-writecache issue Mikulas Patocka
2018-09-18 12:32   ` Dave Chinner [this message]
2018-09-18 12:48     ` Eric Sandeen
2018-09-18 14:09       ` Mikulas Patocka
2018-09-18 14:16         ` Eric Sandeen
2018-09-18 14:19           ` Eric Sandeen
2018-09-18 14:29             ` Mikulas Patocka
2018-09-18 14:36               ` Eric Sandeen
2018-09-18 14:42                 ` Mikulas Patocka
2018-09-18 15:04                   ` Eric Sandeen
2018-09-18 15:27                     ` Eric Sandeen
2018-09-18 15:29                       ` Christoph Hellwig
2018-09-18 17:15                     ` Mikulas Patocka
2018-09-18 14:20       ` David Teigland
2018-09-18 14:23         ` Eric Sandeen
2018-09-18 14:22     ` Mikulas Patocka
2018-09-18 15:33       ` Christoph Hellwig
2018-09-18 17:39         ` Mikulas Patocka
2018-09-18 22:52           ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180918123238.GI27618@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).