All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel C <nix.or.die@gmail.com>
To: Lutz Vieweg <lvml@5t9.de>, "cheater00 ." <cheater00@gmail.com>,
	"Austin S. Hemmelgarn" <ahferroin7@gmail.com>,
	Hugo Mills <hugo@carfax.org.uk>,
	Chris Murphy <lists@colorremedies.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>,
	russell@coker.com.au
Subject: Re: 6TB partition, Data only 2TB - aka When you haven't hit the "usual" problem
Date: Fri, 5 Aug 2016 22:03:43 +0200	[thread overview]
Message-ID: <5ee26e48-d949-502e-5884-6369c9e6b278@gmail.com> (raw)
In-Reply-To: <57A372F3.5090400@5t9.de>


On 04.08.2016 18:53, Lutz Vieweg wrote:
> 
> I was today hit by what I think is probably the same bug:
> A btrfs on a close-to-4TB sized block device, only half filled
> to almost exactly 2 TB, suddenly says "no space left on device"
> upon any attempt to write to it. The filesystem was NOT automatically
> switched to read-only by the kernel, I should mention.
> 
> Re-mounting (which is a pain as this filesystem is used for
> $HOMEs of a multitude of active users who I have to kick from
> the server for doing things like re-mounting) removed the symptom
> for now, but from what I can read in linux-btrfs mailing list
> archives, it pretty likely the symptom will re-appear.
> 
> Here are some more details:
> 
> Software versions:
>> linux-4.6.1 (vanilla from kernel.org)
...
> 
> dmesg output from the time the "no space left on device"-symptom
> appeared:
> 
>> [5171203.601620] WARNING: CPU: 4 PID: 23208 at fs/btrfs/inode.c:9261 btrfs_destroy_inode+0x263/0x2a0 [btrfs]

....
> ...
>> [5171230.306037] WARNING: CPU: 18 PID: 12656 at fs/btrfs/extent-tree.c:4233 btrfs_free_reserved_data_space_noquota+0xf3/0x100 [btrfs]


Sounds like the bug I hit too also ..

To fix this you'll need :


crazy@zwerg:~/Work/linux-git$ git show 8b8b08cbf
commit 8b8b08cbfb9021af4b54b4175fc4c51d655aac8c
Author: Chris Mason <clm@fb.com>
Date:   Tue Jul 19 05:52:36 2016 -0700

    Btrfs: fix delalloc accounting after copy_from_user faults

    Commit 56244ef151c3cd11 was almost but not quite enough to fix the
    reservation math after btrfs_copy_from_user returned partial copies.

    Some users are still seeing warnings in btrfs_destroy_inode, and with a
    long enough test run I'm able to trigger them as well.

    This patch fixes the accounting math again, bringing it much closer to
    the way it was before the sectorsize conversion Chandan did.  The
    problem is accounting for the offset into the page/sector when we do a
    partial copy.  This one just uses the dirty_sectors variable which
    should already be updated properly.

    Signed-off-by: Chris Mason <clm@fb.com>
    cc: stable@vger.kernel.org # v4.6+

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index f3f61d1..bcfb4a2 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1629,13 +1629,11 @@ again:
                 * managed to copy.
                 */
                if (num_sectors > dirty_sectors) {
-                       /*
-                        * we round down because we don't want to count
-                        * any partial blocks actually sent through the
-                        * IO machines
-                        */
-                       release_bytes = round_down(release_bytes - copied,
-                                     root->sectorsize);
+
+                       /* release everything except the sectors we dirtied */
+                       release_bytes -= dirty_sectors <<
+                               root->fs_info->sb->s_blocksize_bits;
+
                        if (copied > 0) {
                                spin_lock(&BTRFS_I(inode)->lock);
                                BTRFS_I(inode)->outstanding_extents++;

  parent reply	other threads:[~2016-08-05 20:04 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 21:44 6TB partition, Data only 2TB - aka When you haven't hit the "usual" problem cheater00 .
2015-12-30 22:13 ` Chris Murphy
2016-01-02  2:09   ` cheater00 .
2016-01-02  2:10     ` cheater00 .
     [not found]       ` <CA+9GZUiWQ2tAotFuq2Svkjnk+2Quz5B8UwZSSpm4SJfhqfoStQ@mail.gmail.com>
2016-01-07 21:55         ` Chris Murphy
     [not found]           ` <CA+9GZUjLcRnRX_mwO-McXWFd+G4o3jtBENMLnszg-rJTn6vL1w@mail.gmail.com>
     [not found]             ` <CAJCQCtRhYZi9nqWP_LYmZeg1yRQVkpnmUDQ-P5o1-gc-3w+Pdg@mail.gmail.com>
2016-01-09 20:00               ` cheater00 .
2016-01-09 20:26                 ` Hugo Mills
2016-01-09 20:59                   ` cheater00 .
2016-01-09 21:04                     ` Hugo Mills
2016-01-09 21:07                       ` cheater00 .
2016-01-09 21:15                         ` Hugo Mills
2016-01-10  3:59                           ` cheater00 .
2016-01-10  6:16                         ` Russell Coker
2016-01-10 22:24                           ` cheater00 .
2016-01-10 22:32                             ` Lionel Bouton
2016-01-11 13:05                         ` Austin S. Hemmelgarn
2016-01-11 13:11                           ` cheater00 .
2016-01-11 13:30                             ` cheater00 .
2016-01-11 13:45                               ` cheater00 .
2016-01-11 14:04                                 ` cheater00 .
2016-01-12  2:18                                   ` Duncan
2016-08-04 16:53                                 ` Lutz Vieweg
2016-08-04 20:30                                   ` Chris Murphy
2016-08-05 10:56                                     ` Lutz Vieweg
2016-08-05 12:12                                       ` Austin S. Hemmelgarn
2016-08-05 13:14                                         ` Lutz Vieweg
2016-08-05 20:03                                   ` Gabriel C [this message]
2016-08-25 15:48                                     ` Lutz Vieweg
2016-01-11 14:10                             ` Austin S. Hemmelgarn
2016-01-11 16:02                               ` cheater00 .
2016-01-11 16:33                                 ` cheater00 .
2016-01-11 20:29                                   ` Henk Slager
2016-01-12  1:16                                     ` Duncan
2016-01-11  0:13                       ` Chris Murphy
2016-01-11  9:03                         ` Hugo Mills
2016-01-11 13:04                           ` cheater00 .
2016-01-11 21:31                           ` Chris Murphy
2016-01-11 22:10                             ` Hugo Mills
2016-01-11 22:20                               ` Chris Murphy
2016-01-11 22:30                                 ` Hugo Mills
2016-01-11 22:39                                   ` Chris Murphy
2016-01-11 23:07                                     ` Hugo Mills
2016-01-11 23:12                                       ` cheater00 .
2016-01-11 23:05                                   ` cheater00 .
2016-01-12  2:05                                   ` Duncan
2016-01-11 22:57                             ` cheater00 .
2016-01-10 14:14                   ` Henk Slager
2016-01-10 23:47                     ` cheater00 .
2016-01-11  0:24                       ` Chris Murphy
2016-01-11  6:07                         ` cheater00 .
2016-01-11  6:24                           ` cheater00 .
2016-01-11  7:54                             ` cheater00 .
2016-01-12  0:35                               ` Duncan
2016-01-11 19:50                       ` Henk Slager
2016-01-11 23:03                         ` cheater00 .

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=5ee26e48-d949-502e-5884-6369c9e6b278@gmail.com \
    --to=nix.or.die@gmail.com \
    --cc=ahferroin7@gmail.com \
    --cc=cheater00@gmail.com \
    --cc=hugo@carfax.org.uk \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=lvml@5t9.de \
    --cc=russell@coker.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.