Bug 1071191
Summary: | [3.5.1] Sporadic SIGBUS with mmap() on a sparse file created with open(), seek(), write() | ||
---|---|---|---|
Product: | [Community] GlusterFS | Reporter: | Niels de Vos <ndevos> |
Component: | write-behind | Assignee: | Niels de Vos <ndevos> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | |
Severity: | high | Docs Contact: | |
Priority: | medium | ||
Version: | 3.5.0 | CC: | gluster-bugs, kkeithle |
Target Milestone: | --- | Keywords: | Patch, Reproducer |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | glusterfs-3.5.1beta | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | 1058663 | Environment: | |
Last Closed: | 2014-06-24 11:03:41 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1058663 | ||
Bug Blocks: | 1071800 |
Description
Niels de Vos
2014-02-28 08:56:16 UTC
REVIEW: http://review.gluster.org/7166 (write-behind: track filesize when doing extending writes) posted (#1) for review on release-3.5 by Niels de Vos (ndevos) COMMIT: http://review.gluster.org/7166 committed in release-3.5 by Niels de Vos (ndevos) ------ commit a256094f34df6500bcd19845fd0f32a9f3690751 Author: Niels de Vos <ndevos> Date: Fri Feb 28 10:03:14 2014 +0100 write-behind: track filesize when doing extending writes A program that calls mmap() on a newly created sparse file, may receive a SIGBUS signal. If SIGBUS is not handled, a segmentation fault will occur and the program will exit. A bug in the write-behind translator can cause the creation of a sparse file created with open(), seek(), write() to be cached. The last write() may not be sent to the server, until write-behind deems this necessary. * open(.., O_TRUNC, ...)/creat() the file, it is 0 bytes big * seek() into the file, use offset 31 * write() 1 byte to the file * the range from byte 0-30 are unwritten so called 'sparse' The following illustration tries to capture this: Legend: [ = start of file _ = unallocated/unwritten bytes # = allocated bytes in the file ] = end of file [_______________#] | | '- byte 0 '- byte 31 Without this change, reading from byte 0-30 will return an error, and reading the same area through an mmap()'d pointer will trigger a SIGBUS. Reading from this range did not trigger the outstanding write() to be flushed. The brick that receives the read() (translated over the network from mmap()) does not know that the file has been extended, and returns -EINVAL. This error gets transported back from the brick to the glusterfs-fuse client, and translated by the Linux kernel/VFS into SIGBUS triggered by mmap(). In order to solve this, a new attribute to the wb_inode structure is introduced; the current size of the file. All FOPs that can modify the size, are expected to update wb_inode->size. This makes it possible for extending writes with an offset bigger than EOF to mark the unwritten area as modified/pending. Cherry picked from commit b0515e2a4a08b657ef7e9715fb8c6222c700e78c: > Change-Id: If5ba6646732e6be26568541ea9b12852a5d0b988 > BUG: 1058663 > Signed-off-by: Niels de Vos <ndevos> > Reviewed-on: http://review.gluster.org/6835 > Tested-by: Gluster Build System <jenkins.com> > Reviewed-by: Raghavendra G <rgowdapp> > Reviewed-by: Anand Avati <avati> Change-Id: Ic73288202c6cb37d8c066628e9c489c6fade49bd BUG: 1071191 Signed-off-by: Niels de Vos <ndevos> Reviewed-on: http://review.gluster.org/7166 Tested-by: Gluster Build System <jenkins.com> The first (and last?) Beta for GlusterFS 3.5.1 has been released [1]. Please verify if the release solves this bug report for you. In case the glusterfs-3.5.1beta release does not have a resolution for this issue, leave a comment in this bug and move the status to ASSIGNED. If this release fixes the problem for you, leave a note and change the status to VERIFIED. Packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update (possibly an "updates-testing" repository) infrastructure for your distribution. [1] http://supercolony.gluster.org/pipermail/gluster-users/2014-May/040377.html [2] http://supercolony.gluster.org/pipermail/gluster-users/ This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.5.1, please reopen this bug report. glusterfs-3.5.1 has been announced on the Gluster Users mailinglist [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution. [1] http://supercolony.gluster.org/pipermail/gluster-users/2014-June/040723.html [2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user |