Commit a2c252eb authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
  GFS2: Use DEFINE_SPINLOCK
  GFS2: cleanup file_operations mess
  GFS2: Move umount flush rwsem
  GFS2: Fix symlink creation race
  GFS2: Make quotad's waiting interruptible
parents 23da64b4 1328df72
...@@ -597,7 +597,6 @@ __acquires(&gl->gl_spin) ...@@ -597,7 +597,6 @@ __acquires(&gl->gl_spin)
GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)); GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags));
down_read(&gfs2_umount_flush_sem);
if (test_bit(GLF_DEMOTE, &gl->gl_flags) && if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
gl->gl_demote_state != gl->gl_state) { gl->gl_demote_state != gl->gl_state) {
if (find_first_holder(gl)) if (find_first_holder(gl))
...@@ -614,15 +613,14 @@ __acquires(&gl->gl_spin) ...@@ -614,15 +613,14 @@ __acquires(&gl->gl_spin)
if (ret == 0) if (ret == 0)
goto out_unlock; goto out_unlock;
if (ret == 2) if (ret == 2)
goto out_sem; goto out;
gh = find_first_waiter(gl); gh = find_first_waiter(gl);
gl->gl_target = gh->gh_state; gl->gl_target = gh->gh_state;
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
do_error(gl, 0); /* Fail queued try locks */ do_error(gl, 0); /* Fail queued try locks */
} }
do_xmote(gl, gh, gl->gl_target); do_xmote(gl, gh, gl->gl_target);
out_sem: out:
up_read(&gfs2_umount_flush_sem);
return; return;
out_sched: out_sched:
...@@ -631,7 +629,7 @@ __acquires(&gl->gl_spin) ...@@ -631,7 +629,7 @@ __acquires(&gl->gl_spin)
gfs2_glock_put(gl); gfs2_glock_put(gl);
out_unlock: out_unlock:
clear_bit(GLF_LOCK, &gl->gl_flags); clear_bit(GLF_LOCK, &gl->gl_flags);
goto out_sem; goto out;
} }
static void glock_work_func(struct work_struct *work) static void glock_work_func(struct work_struct *work)
...@@ -641,6 +639,7 @@ static void glock_work_func(struct work_struct *work) ...@@ -641,6 +639,7 @@ static void glock_work_func(struct work_struct *work)
if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags))
finish_xmote(gl, gl->gl_reply); finish_xmote(gl, gl->gl_reply);
down_read(&gfs2_umount_flush_sem);
spin_lock(&gl->gl_spin); spin_lock(&gl->gl_spin);
if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
gl->gl_state != LM_ST_UNLOCKED && gl->gl_state != LM_ST_UNLOCKED &&
...@@ -653,6 +652,7 @@ static void glock_work_func(struct work_struct *work) ...@@ -653,6 +652,7 @@ static void glock_work_func(struct work_struct *work)
} }
run_queue(gl, 0); run_queue(gl, 0);
spin_unlock(&gl->gl_spin); spin_unlock(&gl->gl_spin);
up_read(&gfs2_umount_flush_sem);
if (!delay || if (!delay ||
queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
gfs2_glock_put(gl); gfs2_glock_put(gl);
......
...@@ -137,15 +137,15 @@ void gfs2_set_iop(struct inode *inode) ...@@ -137,15 +137,15 @@ void gfs2_set_iop(struct inode *inode)
if (S_ISREG(mode)) { if (S_ISREG(mode)) {
inode->i_op = &gfs2_file_iops; inode->i_op = &gfs2_file_iops;
if (gfs2_localflocks(sdp)) if (gfs2_localflocks(sdp))
inode->i_fop = gfs2_file_fops_nolock; inode->i_fop = &gfs2_file_fops_nolock;
else else
inode->i_fop = gfs2_file_fops; inode->i_fop = &gfs2_file_fops;
} else if (S_ISDIR(mode)) { } else if (S_ISDIR(mode)) {
inode->i_op = &gfs2_dir_iops; inode->i_op = &gfs2_dir_iops;
if (gfs2_localflocks(sdp)) if (gfs2_localflocks(sdp))
inode->i_fop = gfs2_dir_fops_nolock; inode->i_fop = &gfs2_dir_fops_nolock;
else else
inode->i_fop = gfs2_dir_fops; inode->i_fop = &gfs2_dir_fops;
} else if (S_ISLNK(mode)) { } else if (S_ISLNK(mode)) {
inode->i_op = &gfs2_symlink_iops; inode->i_op = &gfs2_symlink_iops;
} else { } else {
......
...@@ -101,21 +101,23 @@ void gfs2_dinode_print(const struct gfs2_inode *ip); ...@@ -101,21 +101,23 @@ void gfs2_dinode_print(const struct gfs2_inode *ip);
extern const struct inode_operations gfs2_file_iops; extern const struct inode_operations gfs2_file_iops;
extern const struct inode_operations gfs2_dir_iops; extern const struct inode_operations gfs2_dir_iops;
extern const struct inode_operations gfs2_symlink_iops; extern const struct inode_operations gfs2_symlink_iops;
extern const struct file_operations *gfs2_file_fops_nolock; extern const struct file_operations gfs2_file_fops_nolock;
extern const struct file_operations *gfs2_dir_fops_nolock; extern const struct file_operations gfs2_dir_fops_nolock;
extern void gfs2_set_inode_flags(struct inode *inode); extern void gfs2_set_inode_flags(struct inode *inode);
#ifdef CONFIG_GFS2_FS_LOCKING_DLM #ifdef CONFIG_GFS2_FS_LOCKING_DLM
extern const struct file_operations *gfs2_file_fops; extern const struct file_operations gfs2_file_fops;
extern const struct file_operations *gfs2_dir_fops; extern const struct file_operations gfs2_dir_fops;
static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
{ {
return sdp->sd_args.ar_localflocks; return sdp->sd_args.ar_localflocks;
} }
#else /* Single node only */ #else /* Single node only */
#define gfs2_file_fops NULL #define gfs2_file_fops gfs2_file_fops_nolock
#define gfs2_dir_fops NULL #define gfs2_dir_fops gfs2_dir_fops_nolock
static inline int gfs2_localflocks(const struct gfs2_sbd *sdp) static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
{ {
return 1; return 1;
......
...@@ -705,7 +705,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -705,7 +705,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
} }
} }
const struct file_operations *gfs2_file_fops = &(const struct file_operations){ const struct file_operations gfs2_file_fops = {
.llseek = gfs2_llseek, .llseek = gfs2_llseek,
.read = do_sync_read, .read = do_sync_read,
.aio_read = generic_file_aio_read, .aio_read = generic_file_aio_read,
...@@ -723,7 +723,7 @@ const struct file_operations *gfs2_file_fops = &(const struct file_operations){ ...@@ -723,7 +723,7 @@ const struct file_operations *gfs2_file_fops = &(const struct file_operations){
.setlease = gfs2_setlease, .setlease = gfs2_setlease,
}; };
const struct file_operations *gfs2_dir_fops = &(const struct file_operations){ const struct file_operations gfs2_dir_fops = {
.readdir = gfs2_readdir, .readdir = gfs2_readdir,
.unlocked_ioctl = gfs2_ioctl, .unlocked_ioctl = gfs2_ioctl,
.open = gfs2_open, .open = gfs2_open,
...@@ -735,7 +735,7 @@ const struct file_operations *gfs2_dir_fops = &(const struct file_operations){ ...@@ -735,7 +735,7 @@ const struct file_operations *gfs2_dir_fops = &(const struct file_operations){
#endif /* CONFIG_GFS2_FS_LOCKING_DLM */ #endif /* CONFIG_GFS2_FS_LOCKING_DLM */
const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operations){ const struct file_operations gfs2_file_fops_nolock = {
.llseek = gfs2_llseek, .llseek = gfs2_llseek,
.read = do_sync_read, .read = do_sync_read,
.aio_read = generic_file_aio_read, .aio_read = generic_file_aio_read,
...@@ -751,7 +751,7 @@ const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operat ...@@ -751,7 +751,7 @@ const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operat
.setlease = generic_setlease, .setlease = generic_setlease,
}; };
const struct file_operations *gfs2_dir_fops_nolock = &(const struct file_operations){ const struct file_operations gfs2_dir_fops_nolock = {
.readdir = gfs2_readdir, .readdir = gfs2_readdir,
.unlocked_ioctl = gfs2_ioctl, .unlocked_ioctl = gfs2_ioctl,
.open = gfs2_open, .open = gfs2_open,
......
...@@ -371,6 +371,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry, ...@@ -371,6 +371,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
ip = ghs[1].gh_gl->gl_object; ip = ghs[1].gh_gl->gl_object;
ip->i_disksize = size; ip->i_disksize = size;
i_size_write(inode, size);
error = gfs2_meta_inode_buffer(ip, &dibh); error = gfs2_meta_inode_buffer(ip, &dibh);
......
...@@ -81,7 +81,7 @@ struct gfs2_quota_change_host { ...@@ -81,7 +81,7 @@ struct gfs2_quota_change_host {
static LIST_HEAD(qd_lru_list); static LIST_HEAD(qd_lru_list);
static atomic_t qd_lru_count = ATOMIC_INIT(0); static atomic_t qd_lru_count = ATOMIC_INIT(0);
static spinlock_t qd_lru_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(qd_lru_lock);
int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask) int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask)
{ {
...@@ -1364,7 +1364,7 @@ int gfs2_quotad(void *data) ...@@ -1364,7 +1364,7 @@ int gfs2_quotad(void *data)
refrigerator(); refrigerator();
t = min(quotad_timeo, statfs_timeo); t = min(quotad_timeo, statfs_timeo);
prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_INTERRUPTIBLE);
spin_lock(&sdp->sd_trunc_lock); spin_lock(&sdp->sd_trunc_lock);
empty = list_empty(&sdp->sd_trunc_list); empty = list_empty(&sdp->sd_trunc_list);
spin_unlock(&sdp->sd_trunc_lock); spin_unlock(&sdp->sd_trunc_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment