72 Commits

Author SHA1 Message Date
Niels de Vos
cec37c9b66 logging: remove unused message-id scripts
The current unused implementation for message-ids in the logs depends on
automatically generated files. The generated files are not included in
the distributed tarball. This causes issues when distributions build
packages, they need to re-run ./autogen.sh to create the needed files.

I thought of including the generated files in the distribution tarball.
However, the contents of these files are not actively used, so it seems
to make more sense to drop it all together. These functions were the
only users of libintl and gettext too, so dropped the requirement
checking from configure.ac.

A replacement for the message-id logging framework is in progress. Any
changes that this patch makes, can be reverted in the submission of
patches for the new framework.

Reference: http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/6212
Change-Id: Iea82dd3910944a5c6be3ee393806eccabd575e11
BUG: 1038391
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/7714
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2014-05-22 02:48:58 -07:00
Harshavardhana
aa85de4be3 contrib: Cross platform fixes after recent commits
- provide a getment_r () version which behaves as
  re-entrant with some caveats for NetBSD/OSX specific.
- some apparent warning issues fixed, always use PRI* format
  specification avoid using %ld i.e not portable

Change-Id: Ib3d1a73b426e38b436b356355b97db0104a1a4a5
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/7722
Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2014-05-17 11:52:53 -07:00
Harshavardhana
a3cb38e3ed build: MacOSX Porting fixes
git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs

Working functionality on MacOSX

 - GlusterD (management daemon)
 - GlusterCLI (management cli)
 - GlusterFS FUSE (using OSXFUSE)
 - GlusterNFS (without NLM - issues with rpc.statd)

Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Dennis Schafroth <dennis@schafroth.com>
Reviewed-on: http://review.gluster.org/7503
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2014-04-24 14:41:48 -07:00
Harshavardhana
b66568b6cb build: move argp-standalone into contrib/ directory
Change-Id: Iedcddf95c3577da644c0aebbb297b04c93f1b6fe
BUG: 1081274
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/7352
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2014-04-04 21:52:10 -07:00
Brian Foster
866d079c5b contrib/qemu: remove the CONFIG_INT128 host config option
These leads to compile failures in 32-bit build environments.

BUG: 986775
Change-Id: I0b702f616e1d0e11eda7e55666fd1a7c67bfaeab
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6427
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
2013-12-04 11:29:07 -08:00
Brian Foster
b06ecde299 features/qemu-block: simplify coroutine model to use single synctask, ucontext
The current coroutine model, mapping synctasks 1-1 with qemu internal
Coroutines, has some unresolved raciness issues. This problem usually
manifests as lifecycle mismatches between top-level (gluster created)
synctasks and the subsequently created internal coroutines from that
context. Qemu's internal queueing (and locking) can cause situations
where the top-level synctask is destroyed before the internal scheduler
has released references to memory, leading to use after free crashes
and asserts.

Simplify the coroutine model to use a single synctask as a coroutine
processor and rely on the existing native ucontext coroutine
implementation. The syncenv thread is donated to qemu and ensures a
single top-level coroutine is processed at a time. Qemu now has
complete control over coroutine scheduling.

BUG: 986775
Change-Id: I38223479a608d80353128e390f243933fc946fd6
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6110
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-10 23:45:46 -08:00
Brian Foster
cecc5b8fc0 contrib/qemu: disable coroutine caching in qemu
Coroutine caching in qemu is dangerous in the manner that the
qemu-block translator embeds the qemu block subsystem code. After
a graph switch, new requests can fork off and pass active graph
data structures (i.e., inodes) down into old syncenvs and old
graphs, leading to failures.

BUG: 986775
Change-Id: I7b7226ff57c7867d0e51a58a7c0e58f4d8424c31
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6022
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-10-09 18:57:53 -07:00
Anand Avati
53e98f11d1 features/qemu-block: support for QCOW2 and QED formats
This patch adds support for internals snapshots using QCOW2 and
general framework for external snapshots (next patch) with
QCOW2 and QED.

For internal snapshots, the file must be "initialized" or
"formatted" into QCOW2 format, and specify a file size.

Snapshots can be created, deleted, and applied ("goto").

e.g:

 // Format and Initialize

sh# setfattr -n trusted.glusterfs.block-format -v qcow2:10GB /mnt/imgfile
sh# ls -l /mnt/imgfile
-rw-r--r-- 1 root root 10G Jul 18 21:20 imgfile

 // Create a snapshot

sh# setfattr -n trusted.glusterfs.block-snapshot-create -v name1 imgfile

 // Apply a snapshot

sh# setfattr -n trusted.gluterfs.block-snapshot-goto -v name1 imgfile

Change-Id: If993e057a9455967ba3fa9dcabb7f74b8b2cf4c3
BUG: 986775
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5367
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2013-09-03 11:26:26 -07:00
Anand Avati
0d60175bd6 contrib/qemu: Import qemu block source code
This qemu block format source code and its minimal
dependency files will be used in the next patch to implement
a qemu-block format translator.

Change-Id: Ic87638972f7ea9b3df84d7a0539512a250c11c1c
BUG: 986775
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5366
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2013-09-03 11:25:33 -07:00
Brian Foster
fbc5436335 fuse: sync fuse_kernel.h from linux 3.11.0(-rc3) header
The linux 3.11 fuse kernel header supports up through version 7.22.
Gluster has incrementally supported versions up to 7.22. This is a
hard sync of the most recent kernel header to resolve various,
minor descrepencies and facilitate updates going forward. The
following changes are included:

- Re-typed data structure definitions.
- Missing comments and init flag definitions (i.e., splice).
- Code format and whitespace differences.

No functional changes are included.

BUG: 990744
Change-Id: I86921ef7be56d31bab332cf8589262c2b9348221
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5490
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-08-03 05:50:11 -07:00
Brian Foster
dc72dd5a76 fuse-bridge: update to protocol minor version 22
7.17
- Distinguishes between POSIX and BSD locking support via a
  separate BSD locking support init flag. Older protocol versions
  (since BSD support was added) export both types of locking
  requests if FUSE_POSIX_LOCKS is specified. Gluster sets this
  flag, so set FUSE_FLOCK_LOCKS as well on kernels that support
  version 17 or newer.

7.18
- Adds ioctl() support for directories (and the associated
  FUSE_IOCTL_DIR flag). Gluster does not support the ioctl
  request, so no changes are required. Update the header.
- Adds support for the delete notification to allow a filesystem
  to inform the kernel of a deleted inode. No gluster changes
  required.

7.19
- Adds support for the fallocate request. Gluster already supports
  fallocate and includes the request opcode definition and data
  structure. Update the header version number.

7.20
- Adds the FUSE_AUTO_INVAL_DATA init flag to enable attribute
  updates on reads and automatic cache invalidation on mtime
  changes. Behavior does not change unless the init flag is
  specified, no gluster changes required. Update header.

7.21
- Adds readdirplus support and updates the poll request to include
  events. Gluster already supports readdirplus and includes the
  relevant data structures. Poll is not supported, so no changes
  are required. Update the header with some missing
  READDIRPLUS_AUTO bits.

7.22
- Adds real asynchronous direct I/O support. Gluster already
  supports/enables the associated bit (FUSE_ASYNC_DIO), no further
  changes are required. Update the header.

BUG: 990744
Change-Id: Idf6fd75bbd48189587e548f7624626f9a75309e8
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5489
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-08-03 05:48:44 -07:00
Brian Foster
bc9cf5ba83 fuse-bridge: update to fuse protocol minor version 16 (Linux)
7.14
- Splice write support to fuse device node. No gluster changes
  required besides header update.

7.15
- Store/retrieve notification support. No gluster changes
  required besides header update.

7.16
- BATCH_FORGET request support. Implement a handler for
  BATCH_FORGET requests and update the header.
- Updated ioctl() ABI. No gluster changes required besides
  header update.

BUG: 990744
Change-Id: If3061a720ba566ee6731ad8b77cdc665d8fbf781
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5449
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-08-01 21:02:26 -07:00
Niels de Vos
37d2c255e4 fuse: pass the mountflags to older (< 2.6.21) kernels
The change for Bug 853895 fixed mounting volumes read-only for recent
kernels. Older kernels fail the first mount() syscall, and the second
mount() did not add the 'mountflags'.

Full analysis and a description for reproducing is in the bugreport. The
test included in http://review.gluster.org/4163 would have caught this
problem when the tests are executed on RHEL-5 or similar systems.

Change-Id: I440591344a6a5af7b2018e37a2a1fda9de8b5ab2
Bug: 980770
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/5278
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-07-03 22:33:30 -07:00
Brian Foster
d1ccc4e400 gluster: add fallocate fop support
Implement support for the fallocate file operation. fallocate
allocates blocks for a particular inode such that future writes
to the associated region of the file are guaranteed not to fail
with ENOSPC.

This patch adds fallocate support to the following areas:

	- libglusterfs
	- mount/fuse
	- io-stats
	- performance/md-cache,open-behind
	- quota
	- cluster/afr,dht,stripe
	- rpc/xdr
	- protocol/client,server
	- io-threads
	- marker
	- storage/posix
	- libgfapi

BUG: 949242
Change-Id: Ice8e61351f9d6115c5df68768bc844abbf0ce8bd
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4969
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-06-13 14:37:21 -07:00
Brian Foster
8a7cda772d mount/fuse: enable fuse real async dio when available
fuse has support for optimized async. direct I/O handling via the
FUSE_ASYNC_DIO init flag. Enable FUSE_ASYNC_DIO when advertised
by fuse.

performance/write-behind: fix dio hang

Also fix a hang observed during aio-stress testing due to conflicting
request handling in write-behind. Overlapping requests are skipped
in pick_winds and may never continue when the conflicting write in
progress returns. Add a wb_process_queue() call after a non-wb request
completes to keep the queue moving.

BUG: 963258
Change-Id: Ifba6e8aba7a7790b288a32067706b75f263105d4
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5014
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-05-15 17:19:06 -07:00
Kaleb S. KEITHLEY
caac150b2b Renamed TMP_MAX to GF_TMP_MAX to avoid namespace clash on OSX.
(Just moving things along. I don't mean to step on any toes, but wasn't
sure if I had confused things with my previous review comment.)

Change-Id: I095abf751ef952ba6e225305ec5c2afc5e62ee95
BUG: 919953
Signed-off-by: Justin Clift <jclift@redhat.com>
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/4654
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-03-13 10:33:02 -07:00
Lubomir Rintel
bda7200943 fuse: log options passed to fuse when mount fails
This is done to ease debugging.

Change-Id: I50cfca297e03f41cc47819d0700752e3d24a07d6
BUG: 852754
Signed-off-by: Lubomir Rintel <lubo.rintel@gooddata.com>
Reviewed-on: http://review.gluster.org/3877
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-07 18:18:00 -08:00
Anand Avati
78ae721561 fuse-bridge: use READDIRPLUS support when available
This patch makes use of READDIRPLUS call when support is available
in the kernel.

Change-Id: Iac78881179567856b55af1f46594a2b2859309f0
BUG: 908128
Signed-off-by: Anand V. Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/3905
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2013-02-07 10:26:27 -08:00
Avra Sengupta
777d395fea core: fixes for gcc's '-pedantic' flag build
* warnings on 'void *' arguments
* warnings on empty initializations
* warnings on empty array (array[0])

Change-Id: Iae440f54cbd59580eb69f3ecaed5a9926c0edf95
BUG: 875913
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4219
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-01-21 22:17:36 -08:00
Emmanuel Dreyfus
9a395d2db3 NetBSD MS_RDONLY portability build fix
NetBSD uses MNT_RDONLY where Linux uses MS_RDONLY

BUG: 815227
Change-Id: I8d78831f07e575b215aabc46eaa66e5e277bda0e
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/4299
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-12-12 23:05:55 -08:00
Niels de Vos
702b291297 fuse: handle mountflags properly
The internal mount API had no access to the generic
mountflags used by mount(2).

Thus the "ro" mount option that needs to be passed down to mount(2) as
as a mountflag was incorrectly mangled into the fuse-specific mount
parameter string (cf. http://review.gluster.com/655).

This commit fixes the internal API and the "ro" issue. It also adds a
check for the "rw" and "ro" mount options in tests/basic/mount.t.

Thanks to Csaba Henk (csaba@) for suggestions and proposing an updated
patch.

Change-Id: I7f7bf49ae44d148f5c16f10736a0e412fb8f5e67
BUG: 853895
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4163
Reviewed-by: Csaba Henk <csaba@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2012-11-19 00:49:36 -08:00
Raghavendra Bhat
56d1f81949 glusterfs: add gf_mkostemp api and use it instead of mkostemp of libc
Change-Id: Icc12b99e2233d22037e2c4bb2b6966e45668b7dd
BUG: 764890
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4091
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
2012-10-17 23:37:03 -07:00
Jeff Darcy
58e6296fa2 build: split CPPFLAGS from CFLAGS
Automake provides a separate variable for preprocessor flags
(*_CPPFLAGS). They are already uses in a few places, so make it
consistent and use it everywhere. Note that cflags obtained from
pkg-config often are cppflags, which is why LIBXML2_CFLAGS moves with
into AM_CPPFLAGS, for example.

Change-Id: I15feed1d18b2ca497371271c4b5876d5ec6289dd
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4029
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-03 12:26:45 -07:00
Jeff Darcy
9059a76c67 build: consolidate common compilation flags into one variable
Some -D flags are present in all files, so collect them.
This adds -D${GF_HOST_OS} to some compiler command lines,
but this should not be a problem.

Change-Id: I1aeb346143d4984c9cc4f2750c465ce09af1e6ca
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4013
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-01 16:44:50 -07:00
Emmanuel Dreyfus
a032de191e Detect python > 2.5, make sure MKDIR_P is substituted
gluster build machine generate configure scripts unable to detect python > 2.5
This change include a more recent python.m4 so that newer python can be
correctly detected.

Build.gluster.com also produces a configure that fails to subsitute
MKDIR_P, leading to bugs at make install. Works this around by
introducing mkdirp.m4 from aclocal-1.11, with the autoconf version test
removed because build.gluster.com also has an outdated autoconf. And
we need a bit from a recent autoconf

NB: this patchset changes nothing since the last one, I just fix title
in gerrit.

BUG: 764655
Change-Id: I3ffac50cc7a10cb9e56dd490dbc2b550bba3fabd
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/3888
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-09-09 11:19:18 -07:00
Emmanuel Dreyfus
b10eea2c44 Add missing contrib/libgen files to distribution
BUG: 764655
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Change-Id: I3f49eb4a1a186cb2d178539ada6a05c8c1aa8265
Reviewed-on: http://review.gluster.org/3882
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-08-30 15:24:13 -07:00
Jim Meyering
7820b2c1f8 remove useless if-before-free (and free-like) functions
See comments in http://bugzilla.redhat.com/839925 for
the code to perform this change.

Signed-off-by: Jim Meyering <meyering@redhat.com>
BUG: 839925
Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a
Reviewed-on: http://review.gluster.com/3661
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-07-13 14:03:42 -07:00
Jim Meyering
7c88fcd63d read_conf: don't let a corrupt config file cause invalid line[-1] reference
Change-Id: Ifbc698768d9418a54c1501efa335edd4048cfd41
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3603
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-07-11 19:14:52 -07:00
Jim Meyering
b8bc3adfd9 get_mnt_opts: don't let empty option string cause (*mpt_optsp)[-1] reference
This looks like a "can't happen" case (depending on what add_option does),
so you may prefer to add an assertion instead.

Change-Id: Ibfdd34fca045e5213de836cca252bd96408b2136
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3604
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-07-02 15:58:33 -07:00
Emmanuel Dreyfus
c97c3136bd Switch to GNU basename_r() and dirname_r()
BSD basename() and dirname() return static storage, hence they are not
thread safe, while GNU flavors are. glusterfs assumes the GNU behavior.
As a fix, we added a BSD-derived, thread-safe version of basename_r()
and dirname_r() in contrib/libgen. BSD systems can use it instead of
their built in versions.

Unfortunately, there are more reliance on GNU behavior in glusterfs.
There are place where free() is called on static storage returned by
basename(), place where a second call to dirname() overwrite the
string obtained once, and so forth.

Each of these problems can be fixed, but it is likely to be a pandora
box. We need to accept that glusterfs heavily rely on GNU behavior,
and switch contrib/libgen's basename_r() and dirname_r() to the GNU
version. This change does just that.

BUG: 764655
Change-Id: Id874b9c7aacd9aa3a7a4bd6a92a9633f5b2d6ac0
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3430
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-05-24 21:51:12 -07:00
Csaba Henk
ce6dc515e1 fuse: sync with upstream
Cherry-picked following commits from
git://fuse.git.sourceforge.net/gitroot/fuse/fuse
form 555d6b50..acc5c79d interval:

  commit 1193a39c0869a3608f22472735bcffdcccb6b2a5
  Author: Reuben Hawkins <reubenhwk@gmail.com>

      cleaning up warnings

  commit dba9185999dfa35161d4c810735df0ab3fde5104
  Author: Laszlo Papp <ext-laszlo.papp@nokia.com>

      Check the 'mtablock' for negative value

  commit e63a9d8ee6529c9d15a87745276f45c9bdad3961
  Author: Miklos Szeredi <miklos@szeredi.hu>

      fusermount: clean up do_mount() function

  commit 81fee822a098a3e26969401fc486f136465f96f0
  Author: Laszlo Papp <ext-laszlo.papp@nokia.com>

      Eliminate the unused value

  commit 60eb44ee5eb2756465610b215968f176f4aaac6e
  Author: Laszlo Papp <ext-laszlo.papp@nokia.com>

      Fix resource leaks in fusermount

  commit d6bec4020fddd4dd67248789a1af600580f2cbda
  Author: Miklos Szeredi <mszeredi@suse.cz>

      In case of failure to add to /etc/mtab don't umount.

  commit 1e7607ff89c65b005f69e27aeb1649d624099873
  Author: Miklos Szeredi <mszeredi@suse.cz>

      fusermount: chdir to / before performing mount/umount

  commit 2fcbc2a5a94983813c533c015134c6974f8ee636
  Author: Miklos Szeredi <miklos@szeredi.hu>

      fusermount: don't save/restore cwd

  commit bd99f9cf24e16643752b02fb4fa7b48f2124ab4e
  Author: Miklos Szeredi <miklos@szeredi.hu>

      Fix check for read-only fs in mtab update

Nb.:
- not picked changes that implement and enforce mount/umount
  mechanisms based on newer util-linux features (umount --fake
  and --no-canonicalize)
- not picked fusermount "auto-unmount" feature

Change-Id: Ib9498516184336e77ec047e5414125332d0a4292
BUG: 762389
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3343
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-05-21 13:48:11 -07:00
Csaba Henk
6012dfe6b9 fuse: reorganize mounting code
Macro-driven conditional compilation was a chaos.

New scheme is:

contrib/fuse-lib/mount-common.c:
  libfuse routines used both by glusterfs and fusermount
contrib/fuse-lib/mount.c:
  libfuse-derived but customized mounting code for glusterfs
contrib/fuse-util/mount_util.c:
  libfuse routines used only by fusermount

Change-Id: I3e0ba7f74e36556b78244cd7676eb4d379939602
BUG: 762389
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3342
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-05-21 13:47:41 -07:00
Csaba Henk
439d0426dd fuse, glusterfsd: mount logic fixes
Commit 7d0397c2 introduced two issues:

 i) broke the libfuse derived mount logic (details below)
ii) in case of a daemonized glusterfs client is ran as daemon, parent
    process can return earlier than the mount is in place, which breaks
    agents that programmatically do a gluster mount via a direct call to
    glusterfs (ie. not via mount(8)).

This patch fixes these issues by a refactor that merges the approaches
sported by commits

  7d0397c2 fuse: allow requests during mount (needed for SELinux labels)
  c5d781e0 upon daemonizing, wait on mtab update to terminate in parent

Original daemonized libfuse event flow is as follows:

  try:
    fd = open("/dev/fuse")
    mount("-oopts,fd=%s" % fd ...)
    mount(8) -f    # manipulate mtab
  except:
    sp = socketpair()
    env _FUSE_COMMFD=sp fusermount -oopts
    fd = receive_fd(sp)

  where fusermount(1) does:
    fd = open("/dev/fuse")
    mount("-oopts,fd=%d" % fd ...)
    sp = atoi(getenv("_FUSE_COMMFD"))
    send_fd(sp, fd)

  daemonize(
    # in child
    fuse_loop(fd)
  )
  # in parent
  exit()

As of 013850c9 (instead of adopting FUSE's 47e61004¹), we went for async
mtab manipulation, and as of c5d781e0, still wanted keep that in sync
with termination of daemon parent, so we changed it to:

  try:
    fd = open("/dev/fuse")
    mount("-oopts,fd=%s" % fd ...)
    pid = fork(
      # in child
      mount(8) -f
    )
  except:
    sp = socketpair()
    env _FUSE_COMMFD=sp fusermount -oopts
    fd = receive_fd(sp)

  daemonize(
    fuse_loop(fd)
  )
  waitpid(pid)
  exit()

(Note the new approch came only to direct [privileged] mount, so fusermount
based mounting was already partially broken.)

As of 7d0397c2, with the purpose of facilitating async mount, the event flow
was practically reduced to:

  fd = open("/dev/fuse")
  fork(
    mount("-oopts,fd=%s" % fd ...)
    fork(
      mount(8) -n
    )
  )

  daemonize(
    fuse_loop(fd)
  )
  exit()

Thus fusermount based mounting become defunct; however, the dead
code was still kept around. So, we should either drop it or fix
it. Also, the mtab manipulator is forked into yet another child
with no purpose, while syncing with it in daemon parent is broken.
mount(2) is neither synced with parent.

Now we are coming to the following scheme:

  fd = open("/dev/fuse")
  pid = fork(
    try:
      mount("-oopts,fd=%s" % fd ...)
      mount(8) -n
    except:
      env _FUSE_DEVFD=fd fusermount -oopts
  )

  where fusermount(1) does:
    fd = getenv("_FUSE_DEVFD")
    mount("-oopts,fd=%s" % fd ...)

  daemonize(
    fuse_loop(fd)
  )
  waitpid(pid)
  exit()

Nb.:

- We can't help losing compatibility with upstream fusermount,
  as it sends back the fd only when mount(2) is completed,
  thus defeating the async mount approach. The
  'getenv("_FUSE_DEVFD")' mechanism is specfic to glusterfs'
  fusermount (at the moment -- sure we can talk about it with
  upstream)

- fusermount opens /dev/fuse at same privilege level as of
  original process², so we can bravely go on with doing the open
  unconditionally in original process

- Original mounting code actually tries to mount through
  fusermount _twice_: if first attempt fails, then, assuming
  subtype support is missing in kernel, it tries again subtype
  stripped. However, this is redundant, as fusermount internally
  also performs the subtype check³. Therefore we simplified the
  logic to have just a single fusermount call.

- we revert the changes to mount.glusterfs as of 7d0397c2, as
  now there is no issue with glusterfs to work around in that scope

¹ http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blobdiff;f=ChangeLog;h=47e61004;hb=4c3d9b19;hpb=e61b775a
² http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blob;f=util/fusermount.c;h=b2e87d95#l1023
³ http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blob;f=util/fusermount.c;h=b2e87d95#l839

Change-Id: I0c4ab70e0c5ad7b27337228749b266bcd0ba941d
BUG: 811217
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3341
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-05-21 13:47:09 -07:00
Emmanuel Dreyfus
c023c1517a Provide missing basename_r and dirname_r
Some systems (e.g.: NetBSD) do not have thread-safe basename(3) and
dirname(3). This is fine with OpenGroup's Single Unix Specification
which allows these functions to use static storage. Unfortunately,
glusterfs uses them a lot and assume thread-safety.

This patch brings FreeBSD's thread-safe basename_r(3) and dirname_r(3)
in the contrib directory, and tweaks the build process so that
NetBSD builds use them instead of libc basename(3) and dirname(3)

BUG: 764655
Change-Id: Ic9a159fffdc7bacc9408f8e90854e4c2db81930c
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3320
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-05-18 19:17:58 -07:00
Emmanuel Dreyfus
8c4bf91025 NetBSD build fixes
Change-Id: Ib8183d4b585465d05a7adf3a4ceae93ae1bded15
BUG: 764655
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3238
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
2012-05-11 00:41:24 -07:00
Kaleb KEITHLEY
67ceb347c8 contrib/rbtree: additional license from Richard Fontana
BUG: 807724
Change-Id: I1e9a7aac7b535687b9e48bdb0e94c7f52dc6aad7
Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3252
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-04-30 11:19:08 -07:00
Kaleb KEITHLEY
bb55a0c967 contrib/rbtree license GPL -> LGPL
The latest source of rb.c in the avl-2.0.3 package from GNU/FSF is
now licensed under LGPL, a better license for allowing our partners
to write translators and applications for gluster.

Resubmitting with a BZ. The real question is whether this is okay with
LGPL or whether we should go all the way to a BSD-licensed implementation.

Change-Id: Ifb9c344c84d960832671a2619d37b925e4dede2d
BUG: 807724
Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3008
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2012-04-25 13:19:47 -07:00
Jeff Darcy
7d0397c214 fuse: allow requests during mount (needed for SELinux labels)
Change-Id: Ia1af402897e6a7290acf79617c34fdc804751729
BUG: 811217
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3199
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-04-23 14:37:24 -07:00
Kaleb KEITHLEY
6a995ab330 contrib/md5: prune contrib/md5/* from tree
Previous change set did not delete contrib/md5 from the tree.

BUG: 807718
Change-Id: I74eee1897fac24b83b379f2433de5e4648eb5f4c
Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3095
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-04-11 20:57:57 -07:00
Amar Tumballi
b02afc6d00 core: change lk-owner as a 1k buffer
so, NLM can send the lk-owner field directly to the locks translators,
while doing the same effort, also enabled sending maximum of 500 aux gid
over protocol.

Change-Id: I87c2514392748416f7ffe21d5154faad2e413969
Signed-off-by: Amar Tumballi <amar@gluster.com>
BUG: 767229
Reviewed-on: http://review.gluster.com/779
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
2012-01-24 20:14:17 -08:00
Harshavardhana
5d194403e9 contrib/uuid: Make sure that uuid_types.h are generated per system specific.
Just the same way e2fsprogs maintains. This avoids unnecessary problems
for different architectures.

Change-Id: I3911998373756707996afb7b926ec0780ea18b81
BUG: 3833
Signed-off-by: Harshavardhana <fharshav@redhat.com>
Reviewed-on: http://review.gluster.com/764
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
2011-11-30 23:13:55 -08:00
Emmanuel Dreyfus
3f1092c1a7 We must #include <signal.h> for sigprocmask(2). Failure to do so will break
on NetBSD kernel without COMPAT_13 option.

Change-Id: Ia710bbe31ed48e4df4cd47f99e335d7226b99173
BUG: 2923
Reviewed-on: http://review.gluster.com/594
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@gluster.com>
2011-11-23 23:49:46 -08:00
Emmanuel Dreyfus
8b8459b5ee Use /bin/mount on Linux, /sbin/mount on other systems
Change-Id: I8d2e518d29cedb1fbfa77d0189a2d4a24957e662
BUG: 2923
Reviewed-on: http://review.gluster.com/752
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
2011-11-23 23:48:09 -08:00
Harshavardhana
359eee148b fusermount: Build problem fixed with new glibc
Change-Id: Id25e688d3dbecb74d820388faec5ee5041f21630
BUG: 3797
Reviewed-on: http://review.gluster.com/714
Reviewed-by: Anand Avati <avati@gluster.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2011-11-10 21:27:03 -08:00
Csaba Henk
b27b9d36de geo-rep: implement IP address based access control
- gsyncd gets allow-network tunable which is expected to
  hold a comma-separated list of IP network addresses
- for IP addess matching, bring in ipaddr module from Google
  (http://code.google.com/p/ipaddr-py/, rev. trunk@225)

This will let users control master's access to slave's volumes
until we implement unprivileged geo-rep (delayed due to some
technical issues). It's also needed for the completeness of
our hardening efforts, as plain file slaves won't be able
to work with an unprivileged gsyncd.

Change-Id: I58431cba6592f8672e93ea89a5eef478905b00b9
BUG: 2825
Reviewed-on: http://review.gluster.com/488
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
2011-09-22 05:24:41 -07:00
Vijay Bellur
55219903e3 libglusterfs: Bring in os_daemon_* routines to replace modified FreeBSD code
Change-Id: I41f4635b1b75adb6d22e2e325b99941f8d7a0b42
BUG: 3206
Reviewed-on: http://review.gluster.com/100
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
2011-07-28 02:52:41 -07:00
Amar Tumballi
442f64a83b build: fixes to work on solaris
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 3002 (build issues on solaris)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3002
2011-06-16 22:01:54 -07:00
Anand Avati
291588c6d9 fuse: NetBSD portability fixes
On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip
inexistant /etc/mtab management.

Thanks to: Emmanuel Dreyfus <manu@netbsd.org>

Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 2923 (NetBSD port)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2923
2011-05-30 04:48:34 -07:00
Csaba Henk
c5d781e055 upon daemonizing, wait on mtab update to terminate in parent
This fixes the race in between the mtab update attempts of mount and umount
when we do a lazy umount right after mounting, in order to hide the given fs
instance; yet this way we still avoid the deadlock of the fs and mount which
we can hit if we wait unconditionally for the mtab update to terminate (cf.
bz #511).

Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 2690 (race between mtab updates of mount and umount)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2690
2011-05-19 15:41:47 -07:00
Venky Shankar
2a65986468 build fixes
Signed-off-by: Venky Shankar <venky@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 2550 (build warnings)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2550
2011-04-11 23:50:28 -07:00