Commit 0a33f80a authored by Linus Torvalds's avatar Linus Torvalds

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

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: (25 commits)
  GFS2: Merge gfs2_get_sb into gfs2_get_sb_meta
  GFS2: Fix cache coherency between truncate and O_DIRECT read
  GFS2: Fix locking issue mounting gfs2meta fs
  GFS2: Remove unused variable
  GFS2: smbd proccess hangs with flock() call.
  GFS2: Remove args subdir from gfs2 sysfs files
  GFS2: Remove lockstruct subdir from gfs2 sysfs files
  GFS2: Move gfs2_unlink_ok into ops_inode.c
  GFS2: Move gfs2_readlinki into ops_inode.c
  GFS2: Move gfs2_rmdiri into ops_inode.c
  GFS2: Merge mount.c and ops_super.c into super.c
  GFS2: Clean up some file names
  GFS2: Be more aggressive in reclaiming unlinked inodes
  GFS2: Add a rgrp bitmap full flag
  GFS2: Improve resource group error handling
  GFS2: Don't warn when delete inode fails on ro filesystem
  GFS2: Update docs
  GFS2: Umount recovery race fix
  GFS2: Remove a couple of unused sysfs entries
  GFS2: Add commit= mount option
  ...
parents c29f5ec0 003dec89
...@@ -60,7 +60,7 @@ go_lock | Called for the first local holder of a lock ...@@ -60,7 +60,7 @@ go_lock | Called for the first local holder of a lock
go_unlock | Called on the final local unlock of a lock go_unlock | Called on the final local unlock of a lock
go_dump | Called to print content of object for debugfs file, or on go_dump | Called to print content of object for debugfs file, or on
| error to dump glock to the log. | error to dump glock to the log.
go_type; | The type of the glock, LM_TYPE_..... go_type | The type of the glock, LM_TYPE_.....
go_min_hold_time | The minimum hold time go_min_hold_time | The minimum hold time
The minimum hold time for each lock is the time after a remote lock The minimum hold time for each lock is the time after a remote lock
......
...@@ -11,18 +11,15 @@ their I/O so file system consistency is maintained. One of the nifty ...@@ -11,18 +11,15 @@ their I/O so file system consistency is maintained. One of the nifty
features of GFS is perfect consistency -- changes made to the file system features of GFS is perfect consistency -- changes made to the file system
on one machine show up immediately on all other machines in the cluster. on one machine show up immediately on all other machines in the cluster.
GFS uses interchangable inter-node locking mechanisms. Different lock GFS uses interchangable inter-node locking mechanisms, the currently
modules can plug into GFS and each file system selects the appropriate supported mechanisms are:
lock module at mount time. Lock modules include:
lock_nolock -- allows gfs to be used as a local file system lock_nolock -- allows gfs to be used as a local file system
lock_dlm -- uses a distributed lock manager (dlm) for inter-node locking lock_dlm -- uses a distributed lock manager (dlm) for inter-node locking
The dlm is found at linux/fs/dlm/ The dlm is found at linux/fs/dlm/
In addition to interfacing with an external locking manager, a gfs lock Lock_dlm depends on user space cluster management systems found
module is responsible for interacting with external cluster management
systems. Lock_dlm depends on user space cluster management systems found
at the URL above. at the URL above.
To use gfs as a local file system, no external clustering systems are To use gfs as a local file system, no external clustering systems are
...@@ -31,13 +28,19 @@ needed, simply: ...@@ -31,13 +28,19 @@ needed, simply:
$ mkfs -t gfs2 -p lock_nolock -j 1 /dev/block_device $ mkfs -t gfs2 -p lock_nolock -j 1 /dev/block_device
$ mount -t gfs2 /dev/block_device /dir $ mount -t gfs2 /dev/block_device /dir
GFS2 is not on-disk compatible with previous versions of GFS. If you are using Fedora, you need to install the gfs2-utils package
and, for lock_dlm, you will also need to install the cman package
and write a cluster.conf as per the documentation.
GFS2 is not on-disk compatible with previous versions of GFS, but it
is pretty close.
The following man pages can be found at the URL above: The following man pages can be found at the URL above:
gfs2_fsck to repair a filesystem fsck.gfs2 to repair a filesystem
gfs2_grow to expand a filesystem online gfs2_grow to expand a filesystem online
gfs2_jadd to add journals to a filesystem online gfs2_jadd to add journals to a filesystem online
gfs2_tool to manipulate, examine and tune a filesystem gfs2_tool to manipulate, examine and tune a filesystem
gfs2_quota to examine and change quota values in a filesystem gfs2_quota to examine and change quota values in a filesystem
gfs2_convert to convert a gfs filesystem to gfs2 in-place
mount.gfs2 to help mount(8) mount a filesystem mount.gfs2 to help mount(8) mount a filesystem
mkfs.gfs2 to make a filesystem mkfs.gfs2 to make a filesystem
...@@ -7,6 +7,7 @@ config GFS2_FS ...@@ -7,6 +7,7 @@ config GFS2_FS
select IP_SCTP if DLM_SCTP select IP_SCTP if DLM_SCTP
select FS_POSIX_ACL select FS_POSIX_ACL
select CRC32 select CRC32
select SLOW_WORK
help help
A cluster filesystem. A cluster filesystem.
......
obj-$(CONFIG_GFS2_FS) += gfs2.o obj-$(CONFIG_GFS2_FS) += gfs2.o
gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \ gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \
glops.o inode.o log.o lops.o main.o meta_io.o \ glops.o inode.o log.o lops.o main.o meta_io.o \
mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \ aops.o dentry.o export.o file.o \
ops_fstype.o ops_inode.o ops_super.o quota.o \ ops_fstype.o ops_inode.o quota.o \
recovery.o rgrp.o super.o sys.o trans.o util.o recovery.o rgrp.o super.o sys.o trans.o util.o
gfs2-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o gfs2-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "inode.h" #include "inode.h"
#include "log.h" #include "log.h"
#include "meta_io.h" #include "meta_io.h"
#include "ops_address.h"
#include "quota.h" #include "quota.h"
#include "trans.h" #include "trans.h"
#include "rgrp.h" #include "rgrp.h"
...@@ -781,10 +780,12 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh, ...@@ -781,10 +780,12 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
if (copied) {
if (inode->i_size < to) { if (inode->i_size < to) {
i_size_write(inode, to); i_size_write(inode, to);
ip->i_disksize = inode->i_size; ip->i_disksize = inode->i_size;
di->di_size = cpu_to_be64(inode->i_size); }
gfs2_dinode_out(ip, di);
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
...@@ -824,7 +825,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, ...@@ -824,7 +825,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *dibh; struct buffer_head *dibh;
struct gfs2_alloc *al = ip->i_alloc; struct gfs2_alloc *al = ip->i_alloc;
struct gfs2_dinode *di;
unsigned int from = pos & (PAGE_CACHE_SIZE - 1); unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
unsigned int to = from + len; unsigned int to = from + len;
int ret; int ret;
...@@ -847,11 +847,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, ...@@ -847,11 +847,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
gfs2_page_add_databufs(ip, page, from, to); gfs2_page_add_databufs(ip, page, from, to);
ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
if (ret > 0) {
if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) { if (inode->i_size > ip->i_disksize)
di = (struct gfs2_dinode *)dibh->b_data;
ip->i_disksize = inode->i_size; ip->i_disksize = inode->i_size;
di->di_size = cpu_to_be64(inode->i_size); gfs2_dinode_out(ip, dibh->b_data);
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "trans.h" #include "trans.h"
#include "dir.h" #include "dir.h"
#include "util.h" #include "util.h"
#include "ops_address.h"
/* This doesn't need to be that large as max 64 bit pointers in a 4k /* This doesn't need to be that large as max 64 bit pointers in a 4k
* block is 512, so __u16 is fine for that. It saves stack space to * block is 512, so __u16 is fine for that. It saves stack space to
...@@ -136,7 +135,9 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) ...@@ -136,7 +135,9 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
and write it out to disk */ and write it out to disk */
unsigned int n = 1; unsigned int n = 1;
block = gfs2_alloc_block(ip, &n); error = gfs2_alloc_block(ip, &block, &n);
if (error)
goto out_brelse;
if (isdir) { if (isdir) {
gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), block, 1); gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), block, 1);
error = gfs2_dir_get_new_buffer(ip, block, &bh); error = gfs2_dir_get_new_buffer(ip, block, &bh);
...@@ -476,8 +477,11 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, ...@@ -476,8 +477,11 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
blks = dblks + iblks; blks = dblks + iblks;
i = sheight; i = sheight;
do { do {
int error;
n = blks - alloced; n = blks - alloced;
bn = gfs2_alloc_block(ip, &n); error = gfs2_alloc_block(ip, &bn, &n);
if (error)
return error;
alloced += n; alloced += n;
if (state != ALLOC_DATA || gfs2_is_jdata(ip)) if (state != ALLOC_DATA || gfs2_is_jdata(ip))
gfs2_trans_add_unrevoke(sdp, bn, n); gfs2_trans_add_unrevoke(sdp, bn, n);
...@@ -1008,7 +1012,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping) ...@@ -1008,7 +1012,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
gfs2_trans_add_bh(ip->i_gl, bh, 0); gfs2_trans_add_bh(ip->i_gl, bh, 0);
zero_user(page, offset, length); zero_user(page, offset, length);
mark_buffer_dirty(bh);
unlock: unlock:
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
......
...@@ -803,13 +803,20 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh, ...@@ -803,13 +803,20 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
unsigned int n = 1; unsigned int n = 1;
u64 bn = gfs2_alloc_block(ip, &n); u64 bn;
struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn); int error;
struct buffer_head *bh;
struct gfs2_leaf *leaf; struct gfs2_leaf *leaf;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct qstr name = { .name = "", .len = 0, .hash = 0 }; struct qstr name = { .name = "", .len = 0, .hash = 0 };
error = gfs2_alloc_block(ip, &bn, &n);
if (error)
return NULL;
bh = gfs2_meta_new(ip->i_gl, bn);
if (!bh) if (!bh)
return NULL; return NULL;
gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1); gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1);
gfs2_trans_add_bh(ip->i_gl, bh, 1); gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
......
...@@ -582,8 +582,11 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp) ...@@ -582,8 +582,11 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
struct gfs2_ea_header *ea; struct gfs2_ea_header *ea;
unsigned int n = 1; unsigned int n = 1;
u64 block; u64 block;
int error;
block = gfs2_alloc_block(ip, &n); error = gfs2_alloc_block(ip, &block, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, block, 1); gfs2_trans_add_unrevoke(sdp, block, 1);
*bhp = gfs2_meta_new(ip->i_gl, block); *bhp = gfs2_meta_new(ip->i_gl, block);
gfs2_trans_add_bh(ip->i_gl, *bhp, 1); gfs2_trans_add_bh(ip->i_gl, *bhp, 1);
...@@ -617,6 +620,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, ...@@ -617,6 +620,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
struct gfs2_ea_request *er) struct gfs2_ea_request *er)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
int error;
ea->ea_data_len = cpu_to_be32(er->er_data_len); ea->ea_data_len = cpu_to_be32(er->er_data_len);
ea->ea_name_len = er->er_name_len; ea->ea_name_len = er->er_name_len;
...@@ -642,7 +646,9 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, ...@@ -642,7 +646,9 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
int mh_size = sizeof(struct gfs2_meta_header); int mh_size = sizeof(struct gfs2_meta_header);
unsigned int n = 1; unsigned int n = 1;
block = gfs2_alloc_block(ip, &n); error = gfs2_alloc_block(ip, &block, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, block, 1); gfs2_trans_add_unrevoke(sdp, block, 1);
bh = gfs2_meta_new(ip->i_gl, block); bh = gfs2_meta_new(ip->i_gl, block);
gfs2_trans_add_bh(ip->i_gl, bh, 1); gfs2_trans_add_bh(ip->i_gl, bh, 1);
...@@ -963,7 +969,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, ...@@ -963,7 +969,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
} else { } else {
u64 blk; u64 blk;
unsigned int n = 1; unsigned int n = 1;
blk = gfs2_alloc_block(ip, &n); error = gfs2_alloc_block(ip, &blk, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, blk, 1); gfs2_trans_add_unrevoke(sdp, blk, 1);
indbh = gfs2_meta_new(ip->i_gl, blk); indbh = gfs2_meta_new(ip->i_gl, blk);
gfs2_trans_add_bh(ip->i_gl, indbh, 1); gfs2_trans_add_bh(ip->i_gl, indbh, 1);
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "trans.h" #include "trans.h"
#include "util.h" #include "util.h"
#include "eaops.h" #include "eaops.h"
#include "ops_address.h"
/** /**
* gfs2_llseek - seek to a location in a file * gfs2_llseek - seek to a location in a file
...@@ -425,33 +424,36 @@ static struct vm_operations_struct gfs2_vm_ops = { ...@@ -425,33 +424,36 @@ static struct vm_operations_struct gfs2_vm_ops = {
.page_mkwrite = gfs2_page_mkwrite, .page_mkwrite = gfs2_page_mkwrite,
}; };
/** /**
* gfs2_mmap - * gfs2_mmap -
* @file: The file to map * @file: The file to map
* @vma: The VMA which described the mapping * @vma: The VMA which described the mapping
* *
* Returns: 0 or error code * There is no need to get a lock here unless we should be updating
* atime. We ignore any locking errors since the only consequence is
* a missed atime update (which will just be deferred until later).
*
* Returns: 0
*/ */
static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
if (!(file->f_flags & O_NOATIME)) {
struct gfs2_holder i_gh; struct gfs2_holder i_gh;
int error; int error;
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
error = gfs2_glock_nq(&i_gh); error = gfs2_glock_nq(&i_gh);
if (error) { file_accessed(file);
gfs2_holder_uninit(&i_gh); if (error == 0)
return error; gfs2_glock_dq_uninit(&i_gh);
} }
vma->vm_ops = &gfs2_vm_ops; vma->vm_ops = &gfs2_vm_ops;
vma->vm_flags |= VM_CAN_NONLINEAR;
gfs2_glock_dq_uninit(&i_gh); return 0;
return error;
} }
/** /**
...@@ -692,12 +694,10 @@ static void do_unflock(struct file *file, struct file_lock *fl) ...@@ -692,12 +694,10 @@ static void do_unflock(struct file *file, struct file_lock *fl)
static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
{ {
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
if (!(fl->fl_flags & FL_FLOCK)) if (!(fl->fl_flags & FL_FLOCK))
return -ENOLCK; return -ENOLCK;
if (__mandatory_lock(&ip->i_inode)) if (fl->fl_type & LOCK_MAND)
return -ENOLCK; return -EOPNOTSUPP;
if (fl->fl_type == F_UNLCK) { if (fl->fl_type == F_UNLCK) {
do_unflock(file, fl); do_unflock(file, fl);
......
...@@ -796,7 +796,22 @@ void gfs2_holder_uninit(struct gfs2_holder *gh) ...@@ -796,7 +796,22 @@ void gfs2_holder_uninit(struct gfs2_holder *gh)
gh->gh_ip = 0; gh->gh_ip = 0;
} }
static int just_schedule(void *word) /**
* gfs2_glock_holder_wait
* @word: unused
*
* This function and gfs2_glock_demote_wait both show up in the WCHAN
* field. Thus I've separated these otherwise identical functions in
* order to be more informative to the user.
*/
static int gfs2_glock_holder_wait(void *word)
{
schedule();
return 0;
}
static int gfs2_glock_demote_wait(void *word)
{ {
schedule(); schedule();
return 0; return 0;
...@@ -805,13 +820,13 @@ static int just_schedule(void *word) ...@@ -805,13 +820,13 @@ static int just_schedule(void *word)
static void wait_on_holder(struct gfs2_holder *gh) static void wait_on_holder(struct gfs2_holder *gh)
{ {
might_sleep(); might_sleep();
wait_on_bit(&gh->gh_iflags, HIF_WAIT, just_schedule, TASK_UNINTERRUPTIBLE); wait_on_bit(&gh->gh_iflags, HIF_WAIT, gfs2_glock_holder_wait, TASK_UNINTERRUPTIBLE);
} }
static void wait_on_demote(struct gfs2_glock *gl) static void wait_on_demote(struct gfs2_glock *gl)
{ {
might_sleep(); might_sleep();
wait_on_bit(&gl->gl_flags, GLF_DEMOTE, just_schedule, TASK_UNINTERRUPTIBLE); wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE);
} }
/** /**
......
...@@ -309,24 +309,6 @@ static void rgrp_go_unlock(struct gfs2_holder *gh) ...@@ -309,24 +309,6 @@ static void rgrp_go_unlock(struct gfs2_holder *gh)
gfs2_rgrp_bh_put(gh->gh_gl->gl_object); gfs2_rgrp_bh_put(gh->gh_gl->gl_object);
} }
/**
* rgrp_go_dump - print out an rgrp
* @seq: The iterator
* @gl: The glock in question
*
*/
static int rgrp_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
{
const struct gfs2_rgrpd *rgd = gl->gl_object;
if (rgd == NULL)
return 0;
gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n",
(unsigned long long)rgd->rd_addr, rgd->rd_flags,
rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes);
return 0;
}
/** /**
* trans_go_sync - promote/demote the transaction glock * trans_go_sync - promote/demote the transaction glock
* @gl: the glock * @gl: the glock
...@@ -410,7 +392,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = { ...@@ -410,7 +392,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
.go_demote_ok = rgrp_go_demote_ok, .go_demote_ok = rgrp_go_demote_ok,
.go_lock = rgrp_go_lock, .go_lock = rgrp_go_lock,
.go_unlock = rgrp_go_unlock, .go_unlock = rgrp_go_unlock,
.go_dump = rgrp_go_dump, .go_dump = gfs2_rgrp_dump,
.go_type = LM_TYPE_RGRP, .go_type = LM_TYPE_RGRP,
.go_min_hold_time = HZ / 5, .go_min_hold_time = HZ / 5,
}; };
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/slow-work.h>
#include <linux/dlm.h> #include <linux/dlm.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
...@@ -63,9 +64,12 @@ struct gfs2_log_element { ...@@ -63,9 +64,12 @@ struct gfs2_log_element {
const struct gfs2_log_operations *le_ops; const struct gfs2_log_operations *le_ops;
}; };
#define GBF_FULL 1
struct gfs2_bitmap { struct gfs2_bitmap {
struct buffer_head *bi_bh; struct buffer_head *bi_bh;
char *bi_clone; char *bi_clone;
unsigned long bi_flags;
u32 bi_offset; u32 bi_offset;
u32 bi_start; u32 bi_start;
u32 bi_len; u32 bi_len;
...@@ -90,10 +94,11 @@ struct gfs2_rgrpd { ...@@ -90,10 +94,11 @@ struct gfs2_rgrpd {
struct gfs2_sbd *rd_sbd; struct gfs2_sbd *rd_sbd;
unsigned int rd_bh_count; unsigned int rd_bh_count;
u32 rd_last_alloc; u32 rd_last_alloc;
unsigned char rd_flags; u32 rd_flags;
#define GFS2_RDF_CHECK 0x01 /* Need to check for unlinked inodes */ #define GFS2_RDF_CHECK 0x10000000 /* check for unlinked inodes */
#define GFS2_RDF_NOALLOC 0x02 /* rg prohibits allocation */ #define GFS2_RDF_UPTODATE 0x20000000 /* rg is up to date */
#define GFS2_RDF_UPTODATE 0x04 /* rg is up to date */ #define GFS2_RDF_ERROR 0x40000000 /* error in rg */
#define GFS2_RDF_MASK 0xf0000000 /* mask for internal flags */
}; };
enum gfs2_state_bits { enum gfs2_state_bits {
...@@ -376,11 +381,11 @@ struct gfs2_journal_extent { ...@@ -376,11 +381,11 @@ struct gfs2_journal_extent {
struct gfs2_jdesc { struct gfs2_jdesc {
struct list_head jd_list; struct list_head jd_list;
struct list_head extent_list; struct list_head extent_list;
struct slow_work jd_work;
struct inode *jd_inode; struct inode *jd_inode;
unsigned long jd_flags;
#define JDF_RECOVERY 1
unsigned int jd_jid; unsigned int jd_jid;
int jd_dirty;
unsigned int jd_blocks; unsigned int jd_blocks;
}; };
...@@ -390,9 +395,6 @@ struct gfs2_statfs_change_host { ...@@ -390,9 +395,6 @@ struct gfs2_statfs_change_host {
s64 sc_dinodes; s64 sc_dinodes;
}; };
#define GFS2_GLOCKD_DEFAULT 1
#define GFS2_GLOCKD_MAX 16
#define GFS2_QUOTA_DEFAULT GFS2_QUOTA_OFF #define GFS2_QUOTA_DEFAULT GFS2_QUOTA_OFF
#define GFS2_QUOTA_OFF 0 #define GFS2_QUOTA_OFF 0
#define GFS2_QUOTA_ACCOUNT 1 #define GFS2_QUOTA_ACCOUNT 1
...@@ -418,6 +420,7 @@ struct gfs2_args { ...@@ -418,6 +420,7 @@ struct gfs2_args {
unsigned int ar_data:2; /* ordered/writeback */ unsigned int ar_data:2; /* ordered/writeback */
unsigned int ar_meta:1; /* mount metafs */ unsigned int ar_meta:1; /* mount metafs */
unsigned int ar_discard:1; /* discard requests */ unsigned int ar_discard:1; /* discard requests */
int ar_commit; /* Commit interval */
}; };
struct gfs2_tune { struct gfs2_tune {
...@@ -426,7 +429,6 @@ struct gfs2_tune { ...@@ -426,7 +429,6 @@ struct gfs2_tune {
unsigned int gt_incore_log_blocks; unsigned int gt_incore_log_blocks;
unsigned int gt_log_flush_secs; unsigned int gt_log_flush_secs;
unsigned int gt_recoverd_secs;
unsigned int gt_logd_secs; unsigned int gt_logd_secs;
unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
...@@ -447,6 +449,7 @@ enum { ...@@ -447,6 +449,7 @@ enum {
SDF_JOURNAL_LIVE = 1, SDF_JOURNAL_LIVE = 1,
SDF_SHUTDOWN = 2, SDF_SHUTDOWN = 2,
SDF_NOBARRIERS = 3, SDF_NOBARRIERS = 3,
SDF_NORECOVERY = 4,
}; };
#define GFS2_FSNAME_LEN 256 #define GFS2_FSNAME_LEN 256
...@@ -493,7 +496,6 @@ struct lm_lockstruct { ...@@ -493,7 +496,6 @@ struct lm_lockstruct {
unsigned long ls_flags; unsigned long ls_flags;
dlm_lockspace_t *ls_dlm; dlm_lockspace_t *ls_dlm;
int ls_recover_jid;
int ls_recover_jid_done; int ls_recover_jid_done;
int ls_recover_jid_status; int ls_recover_jid_status;
}; };
...@@ -582,7 +584,6 @@ struct gfs2_sbd { ...@@ -582,7 +584,6 @@ struct gfs2_sbd {
/* Daemon stuff */ /* Daemon stuff */
struct task_struct *sd_recoverd_process;
struct task_struct *sd_logd_process; struct task_struct *sd_logd_process;
struct task_struct *sd_quotad_process; struct task_struct *sd_quotad_process;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "inode.h" #include "inode.h"
#include "log.h" #include "log.h"
#include "meta_io.h" #include "meta_io.h"
#include "ops_address.h"
#include "quota.h" #include "quota.h"
#include "rgrp.h" #include "rgrp.h"
#include "trans.h" #include "trans.h"
...@@ -1047,154 +1046,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, ...@@ -1047,154 +1046,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
return ERR_PTR(error); return ERR_PTR(error);
} }
/** static int __gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
* gfs2_rmdiri - Remove a directory
* @dip: The parent directory of the directory to be removed
* @name: The name of the directory to be removed
* @ip: The GFS2 inode of the directory to be removed
*
* Assumes Glocks on dip and ip are held
*
* Returns: errno
*/
int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip)
{
struct qstr dotname;
int error;
if (ip->i_entries != 2) {
if (gfs2_consist_inode(ip))
gfs2_dinode_print(ip);
return -EIO;
}
error = gfs2_dir_del(dip, name);
if (error)
return error;
error = gfs2_change_nlink(dip, -1);
if (error)
return error;
gfs2_str2qstr(&dotname, ".");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;
gfs2_str2qstr(&dotname, "..");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;
/* It looks odd, but it really should be done twice */
error = gfs2_change_nlink(ip, -1);
if (error)
return error;
error = gfs2_change_nlink(ip, -1);
if (error)
return error;
return error;
}
/*
* gfs2_unlink_ok - check to see that a inode is still in a directory
* @dip: the directory
* @name: the name of the file
* @ip: the inode
*
* Assumes that the lock on (at least) @dip is held.
*
* Returns: 0 if the parent/child relationship is correct, errno if it isn't
*/
int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
const struct gfs2_inode *ip)
{
int error;
if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
return -EPERM;
if ((dip->i_inode.i_mode & S_ISVTX) &&
dip->i_inode.i_uid != current_fsuid() &&
ip->i_inode.i_uid != current_fsuid() && !capable(CAP_FOWNER))
return -EPERM;
if (IS_APPEND(&dip->i_inode))
return -EPERM;
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
if (error)
return error;
error = gfs2_dir_check(&dip->i_inode, name, ip);
if (error)
return error;
return 0;
}
/**
* gfs2_readlinki - return the contents of a symlink
* @ip: the symlink's inode
* @buf: a pointer to the buffer to be filled
* @len: a pointer to the length of @buf
*
* If @buf is too small, a piece of memory is kmalloc()ed and needs
* to be freed by the caller.
*
* Returns: errno
*/
int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
{
struct gfs2_holder i_gh;
struct buffer_head *dibh;
unsigned int x;
int error;
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
error = gfs2_glock_nq(&i_gh);
if (error) {
gfs2_holder_uninit(&i_gh);
return error;
}
if (!ip->i_disksize) {
gfs2_consist_inode(ip);
error = -EIO;
goto out;
}
error = gfs2_meta_inode_buffer(ip, &dibh);
if (error)
goto out;
x = ip->i_disksize + 1;
if (x > *len) {
*buf = kmalloc(x, GFP_NOFS);
if (!*buf) {
error = -ENOMEM;
goto out_brelse;
}
}
memcpy(*buf, dibh->b_data + sizeof(struct gfs2_dinode), x);
*len = x;
out_brelse:
brelse(dibh);
out:
gfs2_glock_dq_uninit(&i_gh);
return error;
}
static int
__gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
{ {
struct buffer_head *dibh; struct buffer_head *dibh;
int error; int error;
......
...@@ -11,8 +11,16 @@ ...@@ -11,8 +11,16 @@
#define __INODE_DOT_H__ #define __INODE_DOT_H__
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/mm.h>
#include "util.h" #include "util.h"
extern int gfs2_releasepage(struct page *page, gfp_t gfp_mask);
extern int gfs2_internal_read(struct gfs2_inode *ip,
struct file_ra_state *ra_state,
char *buf, loff_t *pos, unsigned size);
extern void gfs2_set_aops(struct inode *inode);
static inline int gfs2_is_stuffed(const struct gfs2_inode *ip) static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
{ {
return !ip->i_height; return !ip->i_height;
...@@ -73,30 +81,26 @@ static inline void gfs2_inum_out(const struct gfs2_inode *ip, ...@@ -73,30 +81,26 @@ static inline void gfs2_inum_out(const struct gfs2_inode *ip,
} }
void gfs2_set_iop(struct inode *inode); extern void gfs2_set_iop(struct inode *inode);
struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
u64 no_addr, u64 no_formal_ino, u64 no_addr, u64 no_formal_ino,
int skip_freeing); int skip_freeing);
struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr);
int gfs2_inode_refresh(struct gfs2_inode *ip); extern int gfs2_inode_refresh(struct gfs2_inode *ip);
int gfs2_dinode_dealloc(struct gfs2_inode *inode); extern int gfs2_dinode_dealloc(struct gfs2_inode *inode);
int gfs2_change_nlink(struct gfs2_inode *ip, int diff); extern int gfs2_change_nlink(struct gfs2_inode *ip, int diff);
struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
int is_root); int is_root);
struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, extern struct inode *gfs2_createi(struct gfs2_holder *ghs,
const struct qstr *name,
unsigned int mode, dev_t dev); unsigned int mode, dev_t dev);
int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, extern int gfs2_permission(struct inode *inode, int mask);
struct gfs2_inode *ip); extern int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
const struct gfs2_inode *ip); extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
int gfs2_permission(struct inode *inode, int mask); extern void gfs2_dinode_print(const struct gfs2_inode *ip);
int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len);
int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
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;
......
...@@ -120,7 +120,7 @@ __acquires(&sdp->sd_log_lock) ...@@ -120,7 +120,7 @@ __acquires(&sdp->sd_log_lock)
lock_buffer(bh); lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) { if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} else { } else {
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
...@@ -604,7 +604,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) ...@@ -604,7 +604,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
goto skip_barrier; goto skip_barrier;
get_bh(bh); get_bh(bh);
submit_bh(WRITE_BARRIER | (1 << BIO_RW_META), bh); submit_bh(WRITE_SYNC | (1 << BIO_RW_BARRIER) | (1 << BIO_RW_META), bh);
wait_on_buffer(bh); wait_on_buffer(bh);
if (buffer_eopnotsupp(bh)) { if (buffer_eopnotsupp(bh)) {
clear_buffer_eopnotsupp(bh); clear_buffer_eopnotsupp(bh);
...@@ -664,7 +664,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp) ...@@ -664,7 +664,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
lock_buffer(bh); lock_buffer(bh);
if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) { if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} else { } else {
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <linux/bio.h>
#include <linux/fs.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -189,7 +191,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -189,7 +191,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
} }
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
n = 0; n = 0;
...@@ -199,7 +201,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -199,7 +201,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
lock_buffer(bd2->bd_bh); lock_buffer(bd2->bd_bh);
bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
if (++n >= num) if (++n >= num)
break; break;
...@@ -341,7 +343,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -341,7 +343,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
sdp->sd_log_num_revoke--; sdp->sd_log_num_revoke--;
if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) {
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
bh = gfs2_log_get_buf(sdp); bh = gfs2_log_get_buf(sdp);
mh = (struct gfs2_meta_header *)bh->b_data; mh = (struct gfs2_meta_header *)bh->b_data;
...@@ -358,7 +360,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -358,7 +360,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
} }
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} }
static void revoke_lo_before_scan(struct gfs2_jdesc *jd, static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
...@@ -560,7 +562,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -560,7 +562,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
ptr = bh_log_ptr(bh); ptr = bh_log_ptr(bh);
get_bh(bh); get_bh(bh);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
while(!list_empty(list)) { while(!list_empty(list)) {
bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list); bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list);
...@@ -586,7 +588,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -586,7 +588,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
} else { } else {
bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh); bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh);
} }
submit_bh(WRITE, bh1); submit_bh(WRITE_SYNC_PLUG, bh1);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
ptr += 2; ptr += 2;
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/slow-work.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -113,12 +114,18 @@ static int __init init_gfs2_fs(void) ...@@ -113,12 +114,18 @@ static int __init init_gfs2_fs(void)
if (error) if (error)
goto fail_unregister; goto fail_unregister;
error = slow_work_register_user();
if (error)
goto fail_slow;
gfs2_register_debugfs(); gfs2_register_debugfs();
printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__); printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__);
return 0; return 0;
fail_slow:
unregister_filesystem(&gfs2meta_fs_type);
fail_unregister: fail_unregister:
unregister_filesystem(&gfs2_fs_type); unregister_filesystem(&gfs2_fs_type);
fail: fail:
...@@ -156,6 +163,7 @@ static void __exit exit_gfs2_fs(void) ...@@ -156,6 +163,7 @@ static void __exit exit_gfs2_fs(void)
gfs2_unregister_debugfs(); gfs2_unregister_debugfs();
unregister_filesystem(&gfs2_fs_type); unregister_filesystem(&gfs2_fs_type);
unregister_filesystem(&gfs2meta_fs_type); unregister_filesystem(&gfs2meta_fs_type);
slow_work_unregister_user();
kmem_cache_destroy(gfs2_quotad_cachep); kmem_cache_destroy(gfs2_quotad_cachep);
kmem_cache_destroy(gfs2_rgrpd_cachep); kmem_cache_destroy(gfs2_rgrpd_cachep);
......
...@@ -31,19 +31,66 @@ ...@@ -31,19 +31,66 @@
#include "rgrp.h" #include "rgrp.h"
#include "trans.h" #include "trans.h"
#include "util.h" #include "util.h"
#include "ops_address.h"
static int aspace_get_block(struct inode *inode, sector_t lblock, static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
struct buffer_head *bh_result, int create)
{ {
gfs2_assert_warn(inode->i_sb->s_fs_info, 0); int err;
return -EOPNOTSUPP; struct buffer_head *bh, *head;
} int nr_underway = 0;
int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC_PLUG : WRITE));
static int gfs2_aspace_writepage(struct page *page, BUG_ON(!PageLocked(page));
struct writeback_control *wbc) BUG_ON(!page_has_buffers(page));
{
return block_write_full_page(page, aspace_get_block, wbc); head = page_buffers(page);
bh = head;
do {
if (!buffer_mapped(bh))
continue;
/*
* If it's a fully non-blocking write attempt and we cannot
* lock the buffer then redirty the page. Note that this can
* potentially cause a busy-wait loop from pdflush and kswapd
* activity, but those code paths have their own higher-level
* throttling.
*/
if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) {
lock_buffer(bh);
} else if (!trylock_buffer(bh)) {
redirty_page_for_writepage(wbc, page);
continue;
}
if (test_clear_buffer_dirty(bh)) {
mark_buffer_async_write(bh);
} else {
unlock_buffer(bh);
}
} while ((bh = bh->b_this_page) != head);
/*
* The page and its buffers are protected by PageWriteback(), so we can
* drop the bh refcounts early.
*/
BUG_ON(PageWriteback(page));
set_page_writeback(page);
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
submit_bh(write_op, bh);
nr_underway++;
}
bh = next;
} while (bh != head);
unlock_page(page);
err = 0;
if (nr_underway == 0)
end_page_writeback(page);
return err;
} }
static const struct address_space_operations aspace_aops = { static const struct address_space_operations aspace_aops = {
...@@ -201,16 +248,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) ...@@ -201,16 +248,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
struct buffer_head **bhp) struct buffer_head **bhp)
{ {
*bhp = gfs2_getbuf(gl, blkno, CREATE); struct gfs2_sbd *sdp = gl->gl_sbd;
if (!buffer_uptodate(*bhp)) { struct buffer_head *bh;
ll_rw_block(READ_META, 1, bhp);
if (flags & DIO_WAIT) { if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
int error = gfs2_meta_wait(gl->gl_sbd, *bhp); return -EIO;
if (error) {
brelse(*bhp); *bhp = bh = gfs2_getbuf(gl, blkno, CREATE);
return error;
} lock_buffer(bh);
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
return 0;
} }
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
submit_bh(READ_SYNC | (1 << BIO_RW_META), bh);
if (!(flags & DIO_WAIT))
return 0;
wait_on_buffer(bh);
if (unlikely(!buffer_uptodate(bh))) {
struct gfs2_trans *tr = current->journal_info;
if (tr && tr->tr_touched)
gfs2_io_error_bh(sdp, bh);
brelse(bh);
return -EIO;
} }
return 0; return 0;
...@@ -404,7 +467,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) ...@@ -404,7 +467,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
if (buffer_uptodate(first_bh)) if (buffer_uptodate(first_bh))
goto out; goto out;
if (!buffer_locked(first_bh)) if (!buffer_locked(first_bh))
ll_rw_block(READ_META, 1, &first_bh); ll_rw_block(READ_SYNC | (1 << BIO_RW_META), 1, &first_bh);
dblock++; dblock++;
extlen--; extlen--;
......
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*/
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/gfs2_ondisk.h>
#include <linux/parser.h>
#include "gfs2.h"
#include "incore.h"
#include "super.h"
#include "sys.h"
#include "util.h"
enum {
Opt_lockproto,
Opt_locktable,
Opt_hostdata,
Opt_spectator,
Opt_ignore_local_fs,
Opt_localflocks,
Opt_localcaching,
Opt_debug,
Opt_nodebug,
Opt_upgrade,
Opt_acl,
Opt_noacl,
Opt_quota_off,
Opt_quota_account,
Opt_quota_on,
Opt_quota,
Opt_noquota,
Opt_suiddir,
Opt_nosuiddir,
Opt_data_writeback,
Opt_data_ordered,
Opt_meta,
Opt_discard,
Opt_nodiscard,
Opt_err,
};
static const match_table_t tokens = {
{Opt_lockproto, "lockproto=%s"},
{Opt_locktable, "locktable=%s"},
{Opt_hostdata, "hostdata=%s"},
{Opt_spectator, "spectator"},
{Opt_ignore_local_fs, "ignore_local_fs"},
{Opt_localflocks, "localflocks"},
{Opt_localcaching, "localcaching"},
{Opt_debug, "debug"},
{Opt_nodebug, "nodebug"},
{Opt_upgrade, "upgrade"},
{Opt_acl, "acl"},
{Opt_noacl, "noacl"},
{Opt_quota_off, "quota=off"},
{Opt_quota_account, "quota=account"},
{Opt_quota_on, "quota=on"},
{Opt_quota, "quota"},
{Opt_noquota, "noquota"},
{Opt_suiddir, "suiddir"},
{Opt_nosuiddir, "nosuiddir"},
{Opt_data_writeback, "data=writeback"},
{Opt_data_ordered, "data=ordered"},
{Opt_meta, "meta"},
{Opt_discard, "discard"},
{Opt_nodiscard, "nodiscard"},
{Opt_err, NULL}
};
/**
* gfs2_mount_args - Parse mount options
* @sdp:
* @data:
*
* Return: errno
*/
int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
{
char *o;
int token;
substring_t tmp[MAX_OPT_ARGS];
/* Split the options into tokens with the "," character and
process them */
while (1) {
o = strsep(&options, ",");
if (o == NULL)
break;
if (*o == '\0')
continue;
token = match_token(o, tokens, tmp);
switch (token) {
case Opt_lockproto:
match_strlcpy(args->ar_lockproto, &tmp[0],
GFS2_LOCKNAME_LEN);
break;
case Opt_locktable:
match_strlcpy(args->ar_locktable, &tmp[0],
GFS2_LOCKNAME_LEN);
break;
case Opt_hostdata:
match_strlcpy(args->ar_hostdata, &tmp[0],
GFS2_LOCKNAME_LEN);
break;
case Opt_spectator:
args->ar_spectator = 1;
break;
case Opt_ignore_local_fs:
args->ar_ignore_local_fs = 1;
break;
case Opt_localflocks:
args->ar_localflocks = 1;
break;
case Opt_localcaching:
args->ar_localcaching = 1;
break;
case Opt_debug:
args->ar_debug = 1;
break;
case Opt_nodebug:
args->ar_debug = 0;
break;
case Opt_upgrade:
args->ar_upgrade = 1;
break;
case Opt_acl:
args->ar_posix_acl = 1;
break;
case Opt_noacl:
args->ar_posix_acl = 0;
break;
case Opt_quota_off:
case Opt_noquota:
args->ar_quota = GFS2_QUOTA_OFF;
break;
case Opt_quota_account:
args->ar_quota = GFS2_QUOTA_ACCOUNT;
break;
case Opt_quota_on:
case Opt_quota:
args->ar_quota = GFS2_QUOTA_ON;
break;
case Opt_suiddir:
args->ar_suiddir = 1;
break;
case Opt_nosuiddir:
args->ar_suiddir = 0;
break;
case Opt_data_writeback:
args->ar_data = GFS2_DATA_WRITEBACK;
break;
case Opt_data_ordered:
args->ar_data = GFS2_DATA_ORDERED;
break;
case Opt_meta:
args->ar_meta = 1;
break;
case Opt_discard:
args->ar_discard = 1;
break;
case Opt_nodiscard:
args->ar_discard = 0;
break;
case Opt_err:
default:
fs_info(sdp, "invalid mount option: %s\n", o);
return -EINVAL;
}
}
return 0;
}
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*/
#ifndef __OPS_ADDRESS_DOT_H__
#define __OPS_ADDRESS_DOT_H__
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/mm.h>
extern int gfs2_releasepage(struct page *page, gfp_t gfp_mask);
extern int gfs2_internal_read(struct gfs2_inode *ip,
struct file_ra_state *ra_state,
char *buf, loff_t *pos, unsigned size);
extern void gfs2_set_aops(struct inode *inode);
#endif /* __OPS_ADDRESS_DOT_H__ */
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <linux/slow-work.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -55,8 +56,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt) ...@@ -55,8 +56,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
spin_lock_init(&gt->gt_spin); spin_lock_init(&gt->gt_spin);
gt->gt_incore_log_blocks = 1024; gt->gt_incore_log_blocks = 1024;
gt->gt_log_flush_secs = 60;
gt->gt_recoverd_secs = 60;
gt->gt_logd_secs = 1; gt->gt_logd_secs = 1;
gt->gt_quota_simul_sync = 64; gt->gt_quota_simul_sync = 64;
gt->gt_quota_warn_period = 10; gt->gt_quota_warn_period = 10;
...@@ -676,6 +675,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) ...@@ -676,6 +675,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
break; break;
INIT_LIST_HEAD(&jd->extent_list); INIT_LIST_HEAD(&jd->extent_list);
slow_work_init(&jd->jd_work, &gfs2_recover_ops);
jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1); jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
if (!jd->jd_inode || IS_ERR(jd->jd_inode)) { if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
if (!jd->jd_inode) if (!jd->jd_inode)
...@@ -701,14 +701,13 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) ...@@ -701,14 +701,13 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
{ {
struct inode *master = sdp->sd_master_dir->d_inode; struct inode *master = sdp->sd_master_dir->d_inode;
struct gfs2_holder ji_gh; struct gfs2_holder ji_gh;
struct task_struct *p;
struct gfs2_inode *ip; struct gfs2_inode *ip;
int jindex = 1; int jindex = 1;
int error = 0; int error = 0;
if (undo) { if (undo) {
jindex = 0; jindex = 0;
goto fail_recoverd; goto fail_jinode_gh;
} }
sdp->sd_jindex = gfs2_lookup_simple(master, "jindex"); sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
...@@ -801,18 +800,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) ...@@ -801,18 +800,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
gfs2_glock_dq_uninit(&ji_gh); gfs2_glock_dq_uninit(&ji_gh);
jindex = 0; jindex = 0;
p = kthread_run(gfs2_recoverd, sdp, "gfs2_recoverd");
error = IS_ERR(p);
if (error) {
fs_err(sdp, "can't start recoverd thread: %d\n", error);
goto fail_jinode_gh;
}
sdp->sd_recoverd_process = p;
return 0; return 0;
fail_recoverd:
kthread_stop(sdp->sd_recoverd_process);
fail_jinode_gh: fail_jinode_gh:
if (!sdp->sd_args.ar_spectator) if (!sdp->sd_args.ar_spectator)
gfs2_glock_dq_uninit(&sdp->sd_jinode_gh); gfs2_glock_dq_uninit(&sdp->sd_jinode_gh);
...@@ -1165,6 +1154,7 @@ static int fill_super(struct super_block *sb, void *data, int silent) ...@@ -1165,6 +1154,7 @@ static int fill_super(struct super_block *sb, void *data, int silent)
sdp->sd_args.ar_quota = GFS2_QUOTA_DEFAULT; sdp->sd_args.ar_quota = GFS2_QUOTA_DEFAULT;
sdp->sd_args.ar_data = GFS2_DATA_DEFAULT; sdp->sd_args.ar_data = GFS2_DATA_DEFAULT;
sdp->sd_args.ar_commit = 60;
error = gfs2_mount_args(sdp, &sdp->sd_args, data); error = gfs2_mount_args(sdp, &sdp->sd_args, data);
if (error) { if (error) {
...@@ -1172,8 +1162,10 @@ static int fill_super(struct super_block *sb, void *data, int silent) ...@@ -1172,8 +1162,10 @@ static int fill_super(struct super_block *sb, void *data, int silent)
goto fail; goto fail;
} }
if (sdp->sd_args.ar_spectator) if (sdp->sd_args.ar_spectator) {
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
set_bit(SDF_NORECOVERY, &sdp->sd_flags);
}
if (sdp->sd_args.ar_posix_acl) if (sdp->sd_args.ar_posix_acl)
sb->s_flags |= MS_POSIXACL; sb->s_flags |= MS_POSIXACL;
...@@ -1191,6 +1183,8 @@ static int fill_super(struct super_block *sb, void *data, int silent) ...@@ -1191,6 +1183,8 @@ static int fill_super(struct super_block *sb, void *data, int silent)
GFS2_BASIC_BLOCK_SHIFT; GFS2_BASIC_BLOCK_SHIFT;
sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit;
error = init_names(sdp, silent); error = init_names(sdp, silent);
if (error) if (error)
goto fail; goto fail;
...@@ -1279,9 +1273,22 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags, ...@@ -1279,9 +1273,22 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt); return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt);
} }
static struct super_block *get_gfs2_sb(const char *dev_name) static int test_meta_super(struct super_block *s, void *ptr)
{
struct block_device *bdev = ptr;
return (bdev == s->s_bdev);
}
static int set_meta_super(struct super_block *s, void *ptr)
{
return -EINVAL;
}
static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt)
{ {
struct super_block *sb; struct super_block *s;
struct gfs2_sbd *sdp;
struct path path; struct path path;
int error; int error;
...@@ -1289,30 +1296,17 @@ static struct super_block *get_gfs2_sb(const char *dev_name) ...@@ -1289,30 +1296,17 @@ static struct super_block *get_gfs2_sb(const char *dev_name)
if (error) { if (error) {
printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
dev_name, error); dev_name, error);
return NULL; return error;
} }
sb = path.dentry->d_inode->i_sb; s = sget(&gfs2_fs_type, test_meta_super, set_meta_super,
if (sb && (sb->s_type == &gfs2_fs_type)) path.dentry->d_inode->i_sb->s_bdev);
atomic_inc(&sb->s_active);
else
sb = NULL;
path_put(&path); path_put(&path);
return sb; if (IS_ERR(s)) {
}
static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt)
{
struct super_block *sb = NULL;
struct gfs2_sbd *sdp;
sb = get_gfs2_sb(dev_name);
if (!sb) {
printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
return -ENOENT; return PTR_ERR(s);
} }
sdp = sb->s_fs_info; sdp = s->s_fs_info;
mnt->mnt_sb = sb; mnt->mnt_sb = s;
mnt->mnt_root = dget(sdp->sd_master_dir); mnt->mnt_root = dget(sdp->sd_master_dir);
return 0; return 0;
} }
......
...@@ -262,6 +262,44 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, ...@@ -262,6 +262,44 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
return error; return error;
} }
/*
* gfs2_unlink_ok - check to see that a inode is still in a directory
* @dip: the directory
* @name: the name of the file
* @ip: the inode
*
* Assumes that the lock on (at least) @dip is held.
*
* Returns: 0 if the parent/child relationship is correct, errno if it isn't
*/
static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
const struct gfs2_inode *ip)
{
int error;
if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
return -EPERM;
if ((dip->i_inode.i_mode & S_ISVTX) &&
dip->i_inode.i_uid != current_fsuid() &&
ip->i_inode.i_uid != current_fsuid() && !capable(CAP_FOWNER))
return -EPERM;
if (IS_APPEND(&dip->i_inode))
return -EPERM;
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
if (error)
return error;
error = gfs2_dir_check(&dip->i_inode, name, ip);
if (error)
return error;
return 0;
}
/** /**
* gfs2_unlink - Unlink a file * gfs2_unlink - Unlink a file
* @dir: The inode of the directory containing the file to unlink * @dir: The inode of the directory containing the file to unlink
...@@ -472,6 +510,59 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -472,6 +510,59 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return 0; return 0;
} }
/**
* gfs2_rmdiri - Remove a directory
* @dip: The parent directory of the directory to be removed
* @name: The name of the directory to be removed
* @ip: The GFS2 inode of the directory to be removed
*
* Assumes Glocks on dip and ip are held
*
* Returns: errno
*/
static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip)
{
struct qstr dotname;
int error;
if (ip->i_entries != 2) {
if (gfs2_consist_inode(ip))
gfs2_dinode_print(ip);
return -EIO;
}
error = gfs2_dir_del(dip, name);
if (error)
return error;
error = gfs2_change_nlink(dip, -1);
if (error)
return error;
gfs2_str2qstr(&dotname, ".");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;
gfs2_str2qstr(&dotname, "..");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;
/* It looks odd, but it really should be done twice */
error = gfs2_change_nlink(ip, -1);
if (error)
return error;
error = gfs2_change_nlink(ip, -1);
if (error)
return error;
return error;
}
/** /**
* gfs2_rmdir - Remove a directory * gfs2_rmdir - Remove a directory
* @dir: The parent directory of the directory to be removed * @dir: The parent directory of the directory to be removed
...@@ -884,6 +975,61 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -884,6 +975,61 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
return error; return error;
} }
/**
* gfs2_readlinki - return the contents of a symlink
* @ip: the symlink's inode
* @buf: a pointer to the buffer to be filled
* @len: a pointer to the length of @buf
*
* If @buf is too small, a piece of memory is kmalloc()ed and needs
* to be freed by the caller.
*
* Returns: errno
*/
static int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
{
struct gfs2_holder i_gh;
struct buffer_head *dibh;
unsigned int x;
int error;
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
error = gfs2_glock_nq(&i_gh);
if (error) {
gfs2_holder_uninit(&i_gh);
return error;
}
if (!ip->i_disksize) {
gfs2_consist_inode(ip);
error = -EIO;
goto out;
}
error = gfs2_meta_inode_buffer(ip, &dibh);
if (error)
goto out;
x = ip->i_disksize + 1;
if (x > *len) {
*buf = kmalloc(x, GFP_NOFS);
if (!*buf) {
error = -ENOMEM;
goto out_brelse;
}
}
memcpy(*buf, dibh->b_data + sizeof(struct gfs2_dinode), x);
*len = x;
out_brelse:
brelse(dibh);
out:
gfs2_glock_dq_uninit(&i_gh);
return error;
}
/** /**
* gfs2_readlink - Read the value of a symlink * gfs2_readlink - Read the value of a symlink
* @dentry: the symlink * @dentry: the symlink
......
This diff is collapsed.
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#include "super.h" #include "super.h"
#include "trans.h" #include "trans.h"
#include "inode.h" #include "inode.h"
#include "ops_address.h"
#include "util.h" #include "util.h"
#define QUOTA_USER 1 #define QUOTA_USER 1
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/kthread.h> #include <linux/slow-work.h>
#include <linux/freezer.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -441,18 +440,25 @@ static void gfs2_recovery_done(struct gfs2_sbd *sdp, unsigned int jid, ...@@ -441,18 +440,25 @@ static void gfs2_recovery_done(struct gfs2_sbd *sdp, unsigned int jid,
kobject_uevent_env(&sdp->sd_kobj, KOBJ_CHANGE, envp); kobject_uevent_env(&sdp->sd_kobj, KOBJ_CHANGE, envp);
} }
/** static int gfs2_recover_get_ref(struct slow_work *work)
* gfs2_recover_journal - recover a given journal {
* @jd: the struct gfs2_jdesc describing the journal struct gfs2_jdesc *jd = container_of(work, struct gfs2_jdesc, jd_work);
* if (test_and_set_bit(JDF_RECOVERY, &jd->jd_flags))
* Acquire the journal's lock, check to see if the journal is clean, and return -EBUSY;
* do recovery if necessary. return 0;
* }
* Returns: errno
*/
int gfs2_recover_journal(struct gfs2_jdesc *jd) static void gfs2_recover_put_ref(struct slow_work *work)
{
struct gfs2_jdesc *jd = container_of(work, struct gfs2_jdesc, jd_work);
clear_bit(JDF_RECOVERY, &jd->jd_flags);
smp_mb__after_clear_bit();
wake_up_bit(&jd->jd_flags, JDF_RECOVERY);
}
static void gfs2_recover_work(struct slow_work *work)
{ {
struct gfs2_jdesc *jd = container_of(work, struct gfs2_jdesc, jd_work);
struct gfs2_inode *ip = GFS2_I(jd->jd_inode); struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_log_header_host head; struct gfs2_log_header_host head;
...@@ -569,7 +575,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) ...@@ -569,7 +575,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
gfs2_glock_dq_uninit(&j_gh); gfs2_glock_dq_uninit(&j_gh);
fs_info(sdp, "jid=%u: Done\n", jd->jd_jid); fs_info(sdp, "jid=%u: Done\n", jd->jd_jid);
return 0; return;
fail_gunlock_tr: fail_gunlock_tr:
gfs2_glock_dq_uninit(&t_gh); gfs2_glock_dq_uninit(&t_gh);
...@@ -584,70 +590,28 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) ...@@ -584,70 +590,28 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
fail: fail:
gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP);
return error;
} }
static struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp) struct slow_work_ops gfs2_recover_ops = {
{ .get_ref = gfs2_recover_get_ref,
struct gfs2_jdesc *jd; .put_ref = gfs2_recover_put_ref,
int found = 0; .execute = gfs2_recover_work,
};
spin_lock(&sdp->sd_jindex_spin);
list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
if (jd->jd_dirty) {
jd->jd_dirty = 0;
found = 1;
break;
}
}
spin_unlock(&sdp->sd_jindex_spin);
if (!found)
jd = NULL;
return jd; static int gfs2_recovery_wait(void *word)
}
/**
* gfs2_check_journals - Recover any dirty journals
* @sdp: the filesystem
*
*/
static void gfs2_check_journals(struct gfs2_sbd *sdp)
{ {
struct gfs2_jdesc *jd; schedule();
return 0;
for (;;) {
jd = gfs2_jdesc_find_dirty(sdp);
if (!jd)
break;
if (jd != sdp->sd_jdesc)
gfs2_recover_journal(jd);
}
} }
/** int gfs2_recover_journal(struct gfs2_jdesc *jd)
* gfs2_recoverd - Recover dead machine's journals
* @sdp: Pointer to GFS2 superblock
*
*/
int gfs2_recoverd(void *data)
{ {
struct gfs2_sbd *sdp = data; int rv;
unsigned long t; rv = slow_work_enqueue(&jd->jd_work);
if (rv)
while (!kthread_should_stop()) { return rv;
gfs2_check_journals(sdp); wait_on_bit(&jd->jd_flags, JDF_RECOVERY, gfs2_recovery_wait, TASK_UNINTERRUPTIBLE);
t = gfs2_tune_get(sdp, gt_recoverd_secs) * HZ;
if (freezing(current))
refrigerator();
schedule_timeout_interruptible(t);
}
return 0; return 0;
} }
...@@ -28,7 +28,7 @@ extern void gfs2_revoke_clean(struct gfs2_sbd *sdp); ...@@ -28,7 +28,7 @@ extern void gfs2_revoke_clean(struct gfs2_sbd *sdp);
extern int gfs2_find_jhead(struct gfs2_jdesc *jd, extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head); struct gfs2_log_header_host *head);
extern int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd); extern int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd);
extern int gfs2_recoverd(void *data); extern struct slow_work_ops gfs2_recover_ops;
#endif /* __RECOVERY_DOT_H__ */ #endif /* __RECOVERY_DOT_H__ */
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
#include "inode.h" #include "inode.h"
#include "ops_address.h"
#define BFITNOENT ((u32)~0) #define BFITNOENT ((u32)~0)
#define NO_BLOCK ((u64)~0) #define NO_BLOCK ((u64)~0)
...@@ -442,6 +441,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) ...@@ -442,6 +441,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
for (x = 0; x < length; x++) { for (x = 0; x < length; x++) {
bi = rgd->rd_bits + x; bi = rgd->rd_bits + x;
bi->bi_flags = 0;
/* small rgrp; bitmap stored completely in header block */ /* small rgrp; bitmap stored completely in header block */
if (length == 1) { if (length == 1) {
bytes = bytes_left; bytes = bytes_left;
...@@ -580,7 +580,6 @@ static int read_rindex_entry(struct gfs2_inode *ip, ...@@ -580,7 +580,6 @@ static int read_rindex_entry(struct gfs2_inode *ip,
rgd->rd_gl->gl_object = rgd; rgd->rd_gl->gl_object = rgd;
rgd->rd_flags &= ~GFS2_RDF_UPTODATE; rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
rgd->rd_flags |= GFS2_RDF_CHECK;
return error; return error;
} }
...@@ -701,10 +700,9 @@ static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf) ...@@ -701,10 +700,9 @@ static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf)
u32 rg_flags; u32 rg_flags;
rg_flags = be32_to_cpu(str->rg_flags); rg_flags = be32_to_cpu(str->rg_flags);
if (rg_flags & GFS2_RGF_NOALLOC) rg_flags &= ~GFS2_RDF_MASK;
rgd->rd_flags |= GFS2_RDF_NOALLOC; rgd->rd_flags &= GFS2_RDF_MASK;
else rgd->rd_flags |= rg_flags;
rgd->rd_flags &= ~GFS2_RDF_NOALLOC;
rgd->rd_free = be32_to_cpu(str->rg_free); rgd->rd_free = be32_to_cpu(str->rg_free);
rgd->rd_dinodes = be32_to_cpu(str->rg_dinodes); rgd->rd_dinodes = be32_to_cpu(str->rg_dinodes);
rgd->rd_igeneration = be64_to_cpu(str->rg_igeneration); rgd->rd_igeneration = be64_to_cpu(str->rg_igeneration);
...@@ -713,11 +711,8 @@ static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf) ...@@ -713,11 +711,8 @@ static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf)
static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf) static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf)
{ {
struct gfs2_rgrp *str = buf; struct gfs2_rgrp *str = buf;
u32 rg_flags = 0;
if (rgd->rd_flags & GFS2_RDF_NOALLOC) str->rg_flags = cpu_to_be32(rgd->rd_flags & ~GFS2_RDF_MASK);
rg_flags |= GFS2_RGF_NOALLOC;
str->rg_flags = cpu_to_be32(rg_flags);
str->rg_free = cpu_to_be32(rgd->rd_free); str->rg_free = cpu_to_be32(rgd->rd_free);
str->rg_dinodes = cpu_to_be32(rgd->rd_dinodes); str->rg_dinodes = cpu_to_be32(rgd->rd_dinodes);
str->__pad = cpu_to_be32(0); str->__pad = cpu_to_be32(0);
...@@ -775,8 +770,10 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd) ...@@ -775,8 +770,10 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd)
} }
if (!(rgd->rd_flags & GFS2_RDF_UPTODATE)) { if (!(rgd->rd_flags & GFS2_RDF_UPTODATE)) {
for (x = 0; x < length; x++)
clear_bit(GBF_FULL, &rgd->rd_bits[x].bi_flags);
gfs2_rgrp_in(rgd, (rgd->rd_bits[0].bi_bh)->b_data); gfs2_rgrp_in(rgd, (rgd->rd_bits[0].bi_bh)->b_data);
rgd->rd_flags |= GFS2_RDF_UPTODATE; rgd->rd_flags |= (GFS2_RDF_UPTODATE | GFS2_RDF_CHECK);
} }
spin_lock(&sdp->sd_rindex_spin); spin_lock(&sdp->sd_rindex_spin);
...@@ -903,6 +900,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd) ...@@ -903,6 +900,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd)
continue; continue;
if (sdp->sd_args.ar_discard) if (sdp->sd_args.ar_discard)
gfs2_rgrp_send_discards(sdp, rgd->rd_data0, bi); gfs2_rgrp_send_discards(sdp, rgd->rd_data0, bi);
clear_bit(GBF_FULL, &bi->bi_flags);
memcpy(bi->bi_clone + bi->bi_offset, memcpy(bi->bi_clone + bi->bi_offset,
bi->bi_bh->b_data + bi->bi_offset, bi->bi_len); bi->bi_bh->b_data + bi->bi_offset, bi->bi_len);
} }
...@@ -942,7 +940,7 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) ...@@ -942,7 +940,7 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al)
struct gfs2_sbd *sdp = rgd->rd_sbd; struct gfs2_sbd *sdp = rgd->rd_sbd;
int ret = 0; int ret = 0;
if (rgd->rd_flags & GFS2_RDF_NOALLOC) if (rgd->rd_flags & (GFS2_RGF_NOALLOC | GFS2_RDF_ERROR))
return 0; return 0;
spin_lock(&sdp->sd_rindex_spin); spin_lock(&sdp->sd_rindex_spin);
...@@ -1315,30 +1313,37 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, ...@@ -1315,30 +1313,37 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
{ {
struct gfs2_bitmap *bi = NULL; struct gfs2_bitmap *bi = NULL;
const u32 length = rgd->rd_length; const u32 length = rgd->rd_length;
u32 blk = 0; u32 blk = BFITNOENT;
unsigned int buf, x; unsigned int buf, x;
const unsigned int elen = *n; const unsigned int elen = *n;
const u8 *buffer; const u8 *buffer = NULL;
*n = 0; *n = 0;
/* Find bitmap block that contains bits for goal block */ /* Find bitmap block that contains bits for goal block */
for (buf = 0; buf < length; buf++) { for (buf = 0; buf < length; buf++) {
bi = rgd->rd_bits + buf; bi = rgd->rd_bits + buf;
if (goal < (bi->bi_start + bi->bi_len) * GFS2_NBBY)
break;
}
gfs2_assert(rgd->rd_sbd, buf < length);
/* Convert scope of "goal" from rgrp-wide to within found bit block */ /* Convert scope of "goal" from rgrp-wide to within found bit block */
if (goal < (bi->bi_start + bi->bi_len) * GFS2_NBBY) {
goal -= bi->bi_start * GFS2_NBBY; goal -= bi->bi_start * GFS2_NBBY;
goto do_search;
}
}
buf = 0;
goal = 0;
do_search:
/* Search (up to entire) bitmap in this rgrp for allocatable block. /* Search (up to entire) bitmap in this rgrp for allocatable block.
"x <= length", instead of "x < length", because we typically start "x <= length", instead of "x < length", because we typically start
the search in the middle of a bit block, but if we can't find an the search in the middle of a bit block, but if we can't find an
allocatable block anywhere else, we want to be able wrap around and allocatable block anywhere else, we want to be able wrap around and
search in the first part of our first-searched bit block. */ search in the first part of our first-searched bit block. */
for (x = 0; x <= length; x++) { for (x = 0; x <= length; x++) {
bi = rgd->rd_bits + buf;
if (test_bit(GBF_FULL, &bi->bi_flags) &&
(old_state == GFS2_BLKST_FREE))
goto skip;
/* The GFS2_BLKST_UNLINKED state doesn't apply to the clone /* The GFS2_BLKST_UNLINKED state doesn't apply to the clone
bitmaps, so we must search the originals for that. */ bitmaps, so we must search the originals for that. */
buffer = bi->bi_bh->b_data + bi->bi_offset; buffer = bi->bi_bh->b_data + bi->bi_offset;
...@@ -1349,14 +1354,22 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, ...@@ -1349,14 +1354,22 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
if (blk != BFITNOENT) if (blk != BFITNOENT)
break; break;
if ((goal == 0) && (old_state == GFS2_BLKST_FREE))
set_bit(GBF_FULL, &bi->bi_flags);
/* Try next bitmap block (wrap back to rgrp header if at end) */ /* Try next bitmap block (wrap back to rgrp header if at end) */
buf = (buf + 1) % length; skip:
bi = rgd->rd_bits + buf; buf++;
buf %= length;
goal = 0; goal = 0;
} }
if (blk != BFITNOENT && old_state != new_state) { if (blk == BFITNOENT)
return blk;
*n = 1; *n = 1;
if (old_state == new_state)
goto out;
gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset,
bi->bi_len, blk, new_state); bi->bi_len, blk, new_state);
...@@ -1368,14 +1381,12 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, ...@@ -1368,14 +1381,12 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
if (gfs2_testbit(rgd, buffer, bi->bi_len, goal) != if (gfs2_testbit(rgd, buffer, bi->bi_len, goal) !=
GFS2_BLKST_FREE) GFS2_BLKST_FREE)
break; break;
gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset,
bi->bi_offset, bi->bi_len, goal, bi->bi_len, goal, new_state);
new_state);
(*n)++; (*n)++;
} }
} out:
return (bi->bi_start * GFS2_NBBY) + blk;
return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk;
} }
/** /**
...@@ -1435,13 +1446,33 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, ...@@ -1435,13 +1446,33 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
} }
/** /**
* gfs2_alloc_block - Allocate a block * gfs2_rgrp_dump - print out an rgrp
* @seq: The iterator
* @gl: The glock in question
*
*/
int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl)
{
const struct gfs2_rgrpd *rgd = gl->gl_object;
if (rgd == NULL)
return 0;
gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n",
(unsigned long long)rgd->rd_addr, rgd->rd_flags,
rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes);
return 0;
}
/**
* gfs2_alloc_block - Allocate one or more blocks
* @ip: the inode to allocate the block for * @ip: the inode to allocate the block for
* @bn: Used to return the starting block number
* @n: requested number of blocks/extent length (value/result)
* *
* Returns: the allocated block * Returns: 0 or error
*/ */
u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh; struct buffer_head *dibh;
...@@ -1457,7 +1488,10 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) ...@@ -1457,7 +1488,10 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)
goal = rgd->rd_last_alloc; goal = rgd->rd_last_alloc;
blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED, n); blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED, n);
BUG_ON(blk == BFITNOENT);
/* Since all blocks are reserved in advance, this shouldn't happen */
if (blk == BFITNOENT)
goto rgrp_error;
rgd->rd_last_alloc = blk; rgd->rd_last_alloc = blk;
block = rgd->rd_data0 + blk; block = rgd->rd_data0 + blk;
...@@ -1469,7 +1503,9 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) ...@@ -1469,7 +1503,9 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)
di->di_goal_meta = di->di_goal_data = cpu_to_be64(ip->i_goal); di->di_goal_meta = di->di_goal_data = cpu_to_be64(ip->i_goal);
brelse(dibh); brelse(dibh);
} }
gfs2_assert_withdraw(sdp, rgd->rd_free >= *n); if (rgd->rd_free < *n)
goto rgrp_error;
rgd->rd_free -= *n; rgd->rd_free -= *n;
gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
...@@ -1484,7 +1520,16 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) ...@@ -1484,7 +1520,16 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)
rgd->rd_free_clone -= *n; rgd->rd_free_clone -= *n;
spin_unlock(&sdp->sd_rindex_spin); spin_unlock(&sdp->sd_rindex_spin);
return block; *bn = block;
return 0;
rgrp_error:
fs_warn(sdp, "rgrp %llu has an error, marking it readonly until umount\n",
(unsigned long long)rgd->rd_addr);
fs_warn(sdp, "umount on all nodes and run fsck.gfs2 to fix the error\n");
gfs2_rgrp_dump(NULL, rgd->rd_gl);
rgd->rd_flags |= GFS2_RDF_ERROR;
return -EIO;
} }
/** /**
......
...@@ -14,22 +14,22 @@ struct gfs2_rgrpd; ...@@ -14,22 +14,22 @@ struct gfs2_rgrpd;
struct gfs2_sbd; struct gfs2_sbd;
struct gfs2_holder; struct gfs2_holder;
void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd); extern void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd);
struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk); struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk);
struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp); struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp);
struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd); struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd);
void gfs2_clear_rgrpd(struct gfs2_sbd *sdp); extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp);
int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh); extern int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh);
int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd); extern int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd);
void gfs2_rgrp_bh_hold(struct gfs2_rgrpd *rgd); extern void gfs2_rgrp_bh_hold(struct gfs2_rgrpd *rgd);
void gfs2_rgrp_bh_put(struct gfs2_rgrpd *rgd); extern void gfs2_rgrp_bh_put(struct gfs2_rgrpd *rgd);
void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd); extern void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd);
struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip);
static inline void gfs2_alloc_put(struct gfs2_inode *ip) static inline void gfs2_alloc_put(struct gfs2_inode *ip)
{ {
BUG_ON(ip->i_alloc == NULL); BUG_ON(ip->i_alloc == NULL);
...@@ -37,22 +37,22 @@ static inline void gfs2_alloc_put(struct gfs2_inode *ip) ...@@ -37,22 +37,22 @@ static inline void gfs2_alloc_put(struct gfs2_inode *ip)
ip->i_alloc = NULL; ip->i_alloc = NULL;
} }
int gfs2_inplace_reserve_i(struct gfs2_inode *ip, extern int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file,
char *file, unsigned int line); unsigned int line);
#define gfs2_inplace_reserve(ip) \ #define gfs2_inplace_reserve(ip) \
gfs2_inplace_reserve_i((ip), __FILE__, __LINE__) gfs2_inplace_reserve_i((ip), __FILE__, __LINE__)
void gfs2_inplace_release(struct gfs2_inode *ip); extern void gfs2_inplace_release(struct gfs2_inode *ip);
unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block); extern unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block);
u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n); extern int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n);
u64 gfs2_alloc_di(struct gfs2_inode *ip, u64 *generation); extern u64 gfs2_alloc_di(struct gfs2_inode *ip, u64 *generation);
void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen); extern void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen);
void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen); extern void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen);
void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip); extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip);
void gfs2_unlink_di(struct inode *inode); extern void gfs2_unlink_di(struct inode *inode);
struct gfs2_rgrp_list { struct gfs2_rgrp_list {
unsigned int rl_rgrps; unsigned int rl_rgrps;
...@@ -61,10 +61,11 @@ struct gfs2_rgrp_list { ...@@ -61,10 +61,11 @@ struct gfs2_rgrp_list {
struct gfs2_holder *rl_ghs; struct gfs2_holder *rl_ghs;
}; };
void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist, extern void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist,
u64 block); u64 block);
void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state); extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state);
void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
u64 gfs2_ri_total(struct gfs2_sbd *sdp); extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
extern int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl);
#endif /* __RGRP_DOT_H__ */ #endif /* __RGRP_DOT_H__ */
This diff is collapsed.
This diff is collapsed.
...@@ -33,6 +33,9 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, ...@@ -33,6 +33,9 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
BUG_ON(current->journal_info); BUG_ON(current->journal_info);
BUG_ON(blocks == 0 && revokes == 0); BUG_ON(blocks == 0 && revokes == 0);
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
return -EROFS;
tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS); tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS);
if (!tr) if (!tr)
return -ENOMEM; return -ENOMEM;
...@@ -54,12 +57,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, ...@@ -54,12 +57,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
if (error) if (error)
goto fail_holder_uninit; goto fail_holder_uninit;
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
tr->tr_t_gh.gh_flags |= GL_NOCACHE;
error = -EROFS;
goto fail_gunlock;
}
error = gfs2_log_reserve(sdp, tr->tr_reserved); error = gfs2_log_reserve(sdp, tr->tr_reserved);
if (error) if (error)
goto fail_gunlock; goto fail_gunlock;
......
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