From ee744e0908dca3c954f6b6a922dd48f6f6e8cbc6 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Sun, 1 May 2011 23:40:43 +0000 Subject: performance/write-behind: initialize lock in wb-file before wb-file is set in fd-ctx. - Consider a combination of fuse->quick-read->read-ahead->wb->client. quick-read can do open-behind (open is returned as success even before it is issued to backend) and hence the fd can already be in the list of open fds of the inode. A flush call on some other fd opened on the same inode, will result in ra_flush issuing flush calls to all the fds opened on the same inode. This can result in wb_flush trying to hold a lock on non-initialized lock there by causing memory corruption. Signed-off-by: Raghavendra G Signed-off-by: Vijay Bellur BUG: 2679 (Crash in GlusterFS 3.0.5 in GSP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2679 --- .../performance/write-behind/src/write-behind.c | 52 ++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 79fe056d327..23ea2a0dd0e 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -318,6 +318,8 @@ wb_file_create (xlator_t *this, fd_t *fd, int32_t flags) file->window_conf = conf->window_size; file->flags = flags; + LOCK_INIT (&file->lock); + fd_ctx_set (fd, this, (uint64_t)(long)file); out: @@ -1322,21 +1324,23 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, goto out; } - /* If O_DIRECT then, we disable chaching */ - if (((flags & O_DIRECT) == O_DIRECT) - || ((flags & O_ACCMODE) == O_RDONLY) - || (((flags & O_SYNC) == O_SYNC) - && conf->enable_O_SYNC == _gf_true)) { - file->window_conf = 0; - } + LOCK (&file->lock); + { + /* If O_DIRECT then, we disable chaching */ + if (((flags & O_DIRECT) == O_DIRECT) + || ((flags & O_ACCMODE) == O_RDONLY) + || (((flags & O_SYNC) == O_SYNC) + && conf->enable_O_SYNC == _gf_true)) { + file->window_conf = 0; + } - if (wbflags & GF_OPEN_NOWB) { - file->disabled = 1; + if (wbflags & GF_OPEN_NOWB) { + file->disabled = 1; + } } - - LOCK_INIT (&file->lock); + UNLOCK (&file->lock); } - + out: STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd); return 0; @@ -1396,22 +1400,24 @@ wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - /* If O_DIRECT then, we disable chaching */ - if (frame->local) { - if (((flags & O_DIRECT) == O_DIRECT) - || ((flags & O_ACCMODE) == O_RDONLY) - || (((flags & O_SYNC) == O_SYNC) - && (conf->enable_O_SYNC == _gf_true))) { - file->window_conf = 0; + LOCK (&file->lock); + { + /* If O_DIRECT then, we disable chaching */ + if (frame->local) { + if (((flags & O_DIRECT) == O_DIRECT) + || ((flags & O_ACCMODE) == O_RDONLY) + || (((flags & O_SYNC) == O_SYNC) + && (conf->enable_O_SYNC == _gf_true))) { + file->window_conf = 0; + } } } - - LOCK_INIT (&file->lock); + UNLOCK (&file->lock); } - + frame->local = NULL; -out: +out: STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf, preparent, postparent); return 0; -- cgit From fef771e10b82f84067538d7407da1fa081d189be Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 20 Jun 2011 01:47:28 +0000 Subject: performance/quick-read: reset open_in_transit to zero in case of an error. Signed-off-by: Raghavendra G Signed-off-by: Anand Avati BUG: 3011 (Uninterruptible processes writing(reading ? ) to/from glusterfs share) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3011 --- xlators/performance/quick-read/src/quick-read.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 5cdceb4aeb3..8eaa0613a95 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -137,6 +137,7 @@ qr_resume_pending_ops (qr_fd_ctx_t *qr_fd_ctx) LOCK (&qr_fd_ctx->lock); { + qr_fd_ctx->open_in_transit = 0; list_splice_init (&qr_fd_ctx->waiting_ops, &waiting_ops); } -- cgit From 4adf4973937238a067d17a380aeb5e9878d22580 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 18 Jul 2011 16:08:16 +0530 Subject: s/Patchwork/Gerrit/ Change-Id: I1ac763079cad758c13e97997848c5add7ede48c2 --- commit.sh | 4 --- format-patch.sh | 60 -------------------------------- rfc.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 64 deletions(-) delete mode 100755 commit.sh delete mode 100755 format-patch.sh create mode 100755 rfc.sh diff --git a/commit.sh b/commit.sh deleted file mode 100755 index 9cc55c52e8d..00000000000 --- a/commit.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export EDITOR="emacs" -git commit -a -e "$@" diff --git a/format-patch.sh b/format-patch.sh deleted file mode 100755 index 99afe47123f..00000000000 --- a/format-patch.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - - -function is_num() -{ - local num; - - num="$1"; - - [ -z "$(echo $num | sed -e 's/[0-9]//g')" ] -} - - -function guess_branch() -{ - local branch; - local src_branch; - - branch=$(git branch | grep '*' | cut -f2 -d' '); - - if [ $branch = "master" ] ; then - src_branch="master"; - else - src_branch=$(cat .git/logs/refs/heads/$branch | head -n 1 \ - | sed -r -e 's/.*( [^ ]*)$/\1/g' | cut -f2 -d/); - fi - - echo $src_branch -} - - -function main() -{ - local branch; - local bug; - - branch=$(guess_branch); - echo - echo "Patches are always to be associated with a bug ID. If there is no " - echo "bug filed in bugzilla for this patch, it is highly suggested to file" - echo "a new bug with a description and reasoning of this patchset. If this" - echo "is a new feature, then file a new enhancement bug with a brief " - echo "summary of the feature as the description." - echo - echo -n "Enter bug ID (from http://bugs.gluster.com/): " - read bug; - - [ -z "$bug" ] || is_num $bug || { - log "bug ID should be a valid bug number"; - exit; - } - - if [ -z "$bug" ]; then - git format-patch -s "$@"; - else - git format-patch -s --subject-prefix="PATCH BRANCH:release-3.0 BUG:$bug" "$@"; - fi -} - -main "$@" diff --git a/rfc.sh b/rfc.sh new file mode 100755 index 00000000000..0d2b317930b --- /dev/null +++ b/rfc.sh @@ -0,0 +1,104 @@ +#!/bin/bash -e + + +branch="release-3.0"; + + +function set_hooks_commit_msg() +{ + f=".git/hooks/commit-msg"; + u="http://review.gluster.com/tools/hooks/commit-msg"; + + if [ -x "$f" ]; then + return; + fi + + curl -o $f $u || wget -O $f $u; + + chmod +x .git/hooks/commit-msg; +} + + +function is_num() +{ + local num; + + num="$1"; + + [ -z "$(echo $num | sed -e 's/[0-9]//g')" ] +} + + +function rebase_changes() +{ + git fetch --all; + + EDITOR=$0 git rebase -i origin/$branch; +} + + +function editor_mode() +{ + if [ $(basename "$1") = "git-rebase-todo" ]; then + sed -i 's/^pick /reword /g' "$1"; + return; + fi + + if [ $(basename "$1") = "COMMIT_EDITMSG" ]; then + if grep -qi '^BUG: ' $1; then + return; + fi + while true; do + echo Commit: "\"$(head -n 1 $1)\"" + echo -n "Enter Bug ID: " + read bug + if [ -z "$bug" ]; then + return; + fi + if ! is_num "$bug"; then + echo "Invalid Bug ID ($bug)!!!"; + continue; + fi + + sed -i "s/^\(Change-Id: .*\)$/\1\nBUG: $bug/g" $1; + return; + done + fi + + cat < Date: Thu, 4 Aug 2011 16:33:13 +0530 Subject: use GIT_EDITOR env variable instead of EDITOR Change-Id: Ia9d8281707d144d7b37b5b155e45717e466e5bcf BUG: 3326 Reviewed-on: http://review.gluster.com/164 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- rfc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfc.sh b/rfc.sh index 0d2b317930b..1939f9628b0 100755 --- a/rfc.sh +++ b/rfc.sh @@ -33,7 +33,7 @@ function rebase_changes() { git fetch --all; - EDITOR=$0 git rebase -i origin/$branch; + GIT_EDITOR=$0 git rebase -i origin/$branch; } -- cgit