|
@@ -26,6 +26,7 @@
|
|
#include <linux/dlm.h>
|
|
#include <linux/dlm.h>
|
|
#include <linux/dlm_plock.h>
|
|
#include <linux/dlm_plock.h>
|
|
#include <linux/aio.h>
|
|
#include <linux/aio.h>
|
|
|
|
+#include <linux/delay.h>
|
|
|
|
|
|
#include "gfs2.h"
|
|
#include "gfs2.h"
|
|
#include "incore.h"
|
|
#include "incore.h"
|
|
@@ -979,9 +980,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
|
|
unsigned int state;
|
|
unsigned int state;
|
|
int flags;
|
|
int flags;
|
|
int error = 0;
|
|
int error = 0;
|
|
|
|
+ int sleeptime;
|
|
|
|
|
|
state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
|
|
state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
|
|
- flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT;
|
|
|
|
|
|
+ flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT;
|
|
|
|
|
|
mutex_lock(&fp->f_fl_mutex);
|
|
mutex_lock(&fp->f_fl_mutex);
|
|
|
|
|
|
@@ -1001,7 +1003,14 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
|
|
gfs2_holder_init(gl, state, flags, fl_gh);
|
|
gfs2_holder_init(gl, state, flags, fl_gh);
|
|
gfs2_glock_put(gl);
|
|
gfs2_glock_put(gl);
|
|
}
|
|
}
|
|
- error = gfs2_glock_nq(fl_gh);
|
|
|
|
|
|
+ for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) {
|
|
|
|
+ error = gfs2_glock_nq(fl_gh);
|
|
|
|
+ if (error != GLR_TRYFAILED)
|
|
|
|
+ break;
|
|
|
|
+ fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT;
|
|
|
|
+ fl_gh->gh_error = 0;
|
|
|
|
+ msleep(sleeptime);
|
|
|
|
+ }
|
|
if (error) {
|
|
if (error) {
|
|
gfs2_holder_uninit(fl_gh);
|
|
gfs2_holder_uninit(fl_gh);
|
|
if (error == GLR_TRYFAILED)
|
|
if (error == GLR_TRYFAILED)
|
|
@@ -1024,7 +1033,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
|
|
mutex_lock(&fp->f_fl_mutex);
|
|
mutex_lock(&fp->f_fl_mutex);
|
|
flock_lock_file_wait(file, fl);
|
|
flock_lock_file_wait(file, fl);
|
|
if (fl_gh->gh_gl) {
|
|
if (fl_gh->gh_gl) {
|
|
- gfs2_glock_dq_wait(fl_gh);
|
|
|
|
|
|
+ gfs2_glock_dq(fl_gh);
|
|
gfs2_holder_uninit(fl_gh);
|
|
gfs2_holder_uninit(fl_gh);
|
|
}
|
|
}
|
|
mutex_unlock(&fp->f_fl_mutex);
|
|
mutex_unlock(&fp->f_fl_mutex);
|