Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1347422
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.4 090/342] Btrfs: send, dont BUG_ON() when an empty symlink is found |
| Date | Wed, 02 Mar 2016 02:20:01 +0100 |
| Message-ID | <r83Ch-jE-7@gated-at.bofh.it> (permalink) |
| References | <r82mS-7Ml-9@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; s=mandrill; d=linuxfoundation.org; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=gregkh@linuxfoundation.org; bh=tTClg0424cmQuUnks1zuuy9KMg8=; b=DtdZhHM4eA0PHxNFeJ/vO8Tnsbxgz8yN3yhiicaccaDQ7gpQhNTxzcoyWHBxc0EkS98M43gOdBld ooPbkh32m9DWIXlD3Hy2YaCLblEZBHLLaxyQCR6xAhcyxmHTEJXI5G5PBctKf1wLJVs1iAKEjpWG oqoAl5UbxHCO1b3XJXc= |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1456876453; h=From : Subject : To : Cc : Message-Id : In-Reply-To : References : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=wCmUXgADNG73fmTdvXjtpcvt6Ji4m2havOj4XkAwUT8=; b=C4rrm2zLIqoHmkqDBsb/VPfu31wZKsPkrs8Xs7KHjac3qgcT6q0XKQkThHnQZ0+5C+Wga1 It1gQXONlOjemQlgwvUwWW+G+Ug8JfjDuo+LiUOL+0OaAkIgHhsvMB/JLa/3UuByUPMJ0uY5 96E290DSHPBH9KKOGvfEAdBI40ClA= |
| X-Mailer | git-send-email 2.7.2 |
| X-Report-Abuse | Please forward a copy of this message, including all headers, to abuse@mandrill.com |
| X-Report-Abuse | You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.bd7caaf5f4b6486488342fc42132a593 |
| X-Mandrill-User | md_30481620 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 60 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <stable@vger.kernel.org>, "Stephen R. van den Berg" <srb@cuci.nl>, Filipe Manana <fdmanana@suse.com> |
| X-Original-Date | Tue, 01 Mar 2016 23:54:13 +0000 |
| X-Original-Message-ID | <20160301234530.888484724@linuxfoundation.org> |
| X-Original-References | <20160301234527.990448862@linuxfoundation.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1347422 |
Show key headers only | View raw
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
commit a879719b8c90e15c9e7fa7266d5e3c0ca962f9df upstream.
When a symlink is successfully created it always has an inline extent
containing the source path. However if an error happens when creating
the symlink, we can leave in the subvolume's tree a symlink inode without
any such inline extent item - this happens if after btrfs_symlink() calls
btrfs_end_transaction() and before it calls the inode eviction handler
(through the final iput() call), the transaction gets committed and a
crash happens before the eviction handler gets called, or if a snapshot
of the subvolume is made before the eviction handler gets called. Sadly
we can't just avoid this by making btrfs_symlink() call
btrfs_end_transaction() after it calls the eviction handler, because the
later can commit the current transaction before it removes any items from
the subvolume tree (if it encounters ENOSPC errors while reserving space
for removing all the items).
So make send fail more gracefully, with an -EIO error, and print a
message to dmesg/syslog informing that there's an empty symlink inode,
so that the user can delete the empty symlink or do something else
about it.
Reported-by: Stephen R. van den Berg <srb@cuci.nl>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/send.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1469,7 +1469,21 @@ static int read_symlink(struct btrfs_roo
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto out;
- BUG_ON(ret);
+ if (ret) {
+ /*
+ * An empty symlink inode. Can happen in rare error paths when
+ * creating a symlink (transaction committed before the inode
+ * eviction handler removed the symlink inode items and a crash
+ * happened in between or the subvol was snapshoted in between).
+ * Print an informative message to dmesg/syslog so that the user
+ * can delete the symlink.
+ */
+ btrfs_err(root->fs_info,
+ "Found empty symlink inode %llu at root %llu",
+ ino, root->root_key.objectid);
+ ret = -EIO;
+ goto out;
+ }
ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_file_extent_item);
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 4.4 090/342] Btrfs: send, dont BUG_ON() when an empty symlink is found Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 02:20 +0100
csiph-web