Commit 0248a8be authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gfs2-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:
 "Some relatively minor changes for gfs2:

   - An initial batch of obvious cleanups and fixes from Bob's recovery
     patch queue.

   - Two iomap conversion patches and some cleanups from Christoph
     Hellwig.

   - A cosmetic cleanup from Kefeng Wang (Huawei).

   - Another minor fix and cleanup by me"

* tag 'gfs2-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Remove unused gfs2_iomap_alloc argument
  gfs2: don't use buffer_heads in gfs2_allocate_page_backing
  gfs2: use iomap_bmap instead of generic_block_bmap
  gfs2: mark stuffed_readpage static
  gfs2: merge gfs2_writepage_common into gfs2_writepage
  gfs2: merge gfs2_writeback_aops and gfs2_ordered_aops
  gfs2: remove the unused gfs2_stuffed_write_end function
  gfs2: use page_offset in gfs2_page_mkwrite
  gfs2: replace more printk with calls to fs_info and friends
  gfs2: dump fsid when dumping glock problems
  gfs2: simplify gfs2_freeze by removing case
  gfs2: Rename SDF_SHUTDOWN to SDF_WITHDRAWN
  gfs2: Warn when a journal replay overwrites a rgrp with buffers
  gfs2: log which portion of the journal is replayed
  gfs2: eliminate tr_num_revoke_rm
  gfs2: kthread and remount improvements
  gfs2: Use IS_ERR_OR_NULL
  gfs2: Clean up freeing struct gfs2_sbd
parents 2e756758 bb4cb25d
...@@ -82,15 +82,11 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock, ...@@ -82,15 +82,11 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
} }
/** /**
* gfs2_writepage_common - Common bits of writepage * gfs2_writepage - Write page for writeback mappings
* @page: The page to be written * @page: The page
* @wbc: The writeback control * @wbc: The writeback control
*
* Returns: 1 if writepage is ok, otherwise an error code or zero if no error.
*/ */
static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
static int gfs2_writepage_common(struct page *page,
struct writeback_control *wbc)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
...@@ -109,7 +105,9 @@ static int gfs2_writepage_common(struct page *page, ...@@ -109,7 +105,9 @@ static int gfs2_writepage_common(struct page *page,
page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE); page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
goto out; goto out;
} }
return 1;
return nobh_writepage(page, gfs2_get_block_noalloc, wbc);
redirty: redirty:
redirty_page_for_writepage(wbc, page); redirty_page_for_writepage(wbc, page);
out: out:
...@@ -117,24 +115,6 @@ static int gfs2_writepage_common(struct page *page, ...@@ -117,24 +115,6 @@ static int gfs2_writepage_common(struct page *page,
return 0; return 0;
} }
/**
* gfs2_writepage - Write page for writeback mappings
* @page: The page
* @wbc: The writeback control
*
*/
static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
{
int ret;
ret = gfs2_writepage_common(page, wbc);
if (ret <= 0)
return ret;
return nobh_writepage(page, gfs2_get_block_noalloc, wbc);
}
/* This is the same as calling block_write_full_page, but it also /* This is the same as calling block_write_full_page, but it also
* writes pages outside of i_size * writes pages outside of i_size
*/ */
...@@ -454,8 +434,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping, ...@@ -454,8 +434,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping,
* *
* Returns: errno * Returns: errno
*/ */
static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
{ {
struct buffer_head *dibh; struct buffer_head *dibh;
u64 dsize = i_size_read(&ip->i_inode); u64 dsize = i_size_read(&ip->i_inode);
...@@ -518,7 +497,7 @@ static int __gfs2_readpage(void *file, struct page *page) ...@@ -518,7 +497,7 @@ static int __gfs2_readpage(void *file, struct page *page)
error = mpage_readpage(page, gfs2_block_map); error = mpage_readpage(page, gfs2_block_map);
} }
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
return -EIO; return -EIO;
return error; return error;
...@@ -635,7 +614,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping, ...@@ -635,7 +614,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
gfs2_glock_dq(&gh); gfs2_glock_dq(&gh);
out_uninit: out_uninit:
gfs2_holder_uninit(&gh); gfs2_holder_uninit(&gh);
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
ret = -EIO; ret = -EIO;
return ret; return ret;
} }
...@@ -685,47 +664,6 @@ void adjust_fs_space(struct inode *inode) ...@@ -685,47 +664,6 @@ void adjust_fs_space(struct inode *inode)
gfs2_trans_end(sdp); gfs2_trans_end(sdp);
} }
/**
* gfs2_stuffed_write_end - Write end for stuffed files
* @inode: The inode
* @dibh: The buffer_head containing the on-disk inode
* @pos: The file position
* @copied: How much was actually copied by the VFS
* @page: The page
*
* This copies the data from the page into the inode block after
* the inode data structure itself.
*
* Returns: copied bytes or errno
*/
int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
loff_t pos, unsigned copied,
struct page *page)
{
struct gfs2_inode *ip = GFS2_I(inode);
u64 to = pos + copied;
void *kaddr;
unsigned char *buf = dibh->b_data + sizeof(struct gfs2_dinode);
BUG_ON(pos + copied > gfs2_max_stuffed_size(ip));
kaddr = kmap_atomic(page);
memcpy(buf + pos, kaddr + pos, copied);
flush_dcache_page(page);
kunmap_atomic(kaddr);
WARN_ON(!PageUptodate(page));
unlock_page(page);
put_page(page);
if (copied) {
if (inode->i_size < to)
i_size_write(inode, to);
mark_inode_dirty(inode);
}
return copied;
}
/** /**
* jdata_set_page_dirty - Page dirtying function * jdata_set_page_dirty - Page dirtying function
* @page: The page to dirty * @page: The page to dirty
...@@ -759,7 +697,7 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) ...@@ -759,7 +697,7 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
return 0; return 0;
if (!gfs2_is_stuffed(ip)) if (!gfs2_is_stuffed(ip))
dblock = generic_block_bmap(mapping, lblock, gfs2_block_map); dblock = iomap_bmap(mapping, lblock, &gfs2_iomap_ops);
gfs2_glock_dq_uninit(&i_gh); gfs2_glock_dq_uninit(&i_gh);
...@@ -888,7 +826,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask) ...@@ -888,7 +826,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
return 0; return 0;
} }
static const struct address_space_operations gfs2_writeback_aops = { static const struct address_space_operations gfs2_aops = {
.writepage = gfs2_writepage, .writepage = gfs2_writepage,
.writepages = gfs2_writepages, .writepages = gfs2_writepages,
.readpage = gfs2_readpage, .readpage = gfs2_readpage,
...@@ -902,21 +840,6 @@ static const struct address_space_operations gfs2_writeback_aops = { ...@@ -902,21 +840,6 @@ static const struct address_space_operations gfs2_writeback_aops = {
.error_remove_page = generic_error_remove_page, .error_remove_page = generic_error_remove_page,
}; };
static const struct address_space_operations gfs2_ordered_aops = {
.writepage = gfs2_writepage,
.writepages = gfs2_writepages,
.readpage = gfs2_readpage,
.readpages = gfs2_readpages,
.set_page_dirty = __set_page_dirty_buffers,
.bmap = gfs2_bmap,
.invalidatepage = gfs2_invalidatepage,
.releasepage = gfs2_releasepage,
.direct_IO = noop_direct_IO,
.migratepage = buffer_migrate_page,
.is_partially_uptodate = block_is_partially_uptodate,
.error_remove_page = generic_error_remove_page,
};
static const struct address_space_operations gfs2_jdata_aops = { static const struct address_space_operations gfs2_jdata_aops = {
.writepage = gfs2_jdata_writepage, .writepage = gfs2_jdata_writepage,
.writepages = gfs2_jdata_writepages, .writepages = gfs2_jdata_writepages,
...@@ -932,15 +855,8 @@ static const struct address_space_operations gfs2_jdata_aops = { ...@@ -932,15 +855,8 @@ static const struct address_space_operations gfs2_jdata_aops = {
void gfs2_set_aops(struct inode *inode) void gfs2_set_aops(struct inode *inode)
{ {
struct gfs2_inode *ip = GFS2_I(inode); if (gfs2_is_jdata(GFS2_I(inode)))
struct gfs2_sbd *sdp = GFS2_SB(inode);
if (gfs2_is_jdata(ip))
inode->i_mapping->a_ops = &gfs2_jdata_aops; inode->i_mapping->a_ops = &gfs2_jdata_aops;
else if (gfs2_is_writeback(sdp))
inode->i_mapping->a_ops = &gfs2_writeback_aops;
else if (gfs2_is_ordered(sdp))
inode->i_mapping->a_ops = &gfs2_ordered_aops;
else else
BUG(); inode->i_mapping->a_ops = &gfs2_aops;
} }
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#include "incore.h" #include "incore.h"
extern int stuffed_readpage(struct gfs2_inode *ip, struct page *page);
extern int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
loff_t pos, unsigned copied,
struct page *page);
extern void adjust_fs_space(struct inode *inode); extern void adjust_fs_space(struct inode *inode);
extern void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page, extern void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
unsigned int from, unsigned int len); unsigned int from, unsigned int len);
......
...@@ -595,7 +595,6 @@ enum alloc_state { ...@@ -595,7 +595,6 @@ enum alloc_state {
* gfs2_iomap_alloc - Build a metadata tree of the requested height * gfs2_iomap_alloc - Build a metadata tree of the requested height
* @inode: The GFS2 inode * @inode: The GFS2 inode
* @iomap: The iomap structure * @iomap: The iomap structure
* @flags: iomap flags
* @mp: The metapath, with proper height information calculated * @mp: The metapath, with proper height information calculated
* *
* In this routine we may have to alloc: * In this routine we may have to alloc:
...@@ -622,7 +621,7 @@ enum alloc_state { ...@@ -622,7 +621,7 @@ enum alloc_state {
*/ */
static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
unsigned flags, struct metapath *mp) struct metapath *mp)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
...@@ -1088,7 +1087,7 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, ...@@ -1088,7 +1087,7 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos,
} }
if (iomap->type == IOMAP_HOLE) { if (iomap->type == IOMAP_HOLE) {
ret = gfs2_iomap_alloc(inode, iomap, flags, mp); ret = gfs2_iomap_alloc(inode, iomap, mp);
if (ret) { if (ret) {
gfs2_trans_end(sdp); gfs2_trans_end(sdp);
gfs2_inplace_release(ip); gfs2_inplace_release(ip);
...@@ -1234,7 +1233,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, ...@@ -1234,7 +1233,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
if (create) { if (create) {
ret = gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, &iomap, &mp); ret = gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, &iomap, &mp);
if (!ret && iomap.type == IOMAP_HOLE) if (!ret && iomap.type == IOMAP_HOLE)
ret = gfs2_iomap_alloc(inode, &iomap, IOMAP_WRITE, &mp); ret = gfs2_iomap_alloc(inode, &iomap, &mp);
release_metapath(&mp); release_metapath(&mp);
} else { } else {
ret = gfs2_iomap_get(inode, pos, length, 0, &iomap, &mp); ret = gfs2_iomap_get(inode, pos, length, 0, &iomap, &mp);
...@@ -1464,7 +1463,7 @@ int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length, ...@@ -1464,7 +1463,7 @@ int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length,
ret = gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, iomap, &mp); ret = gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, iomap, &mp);
if (!ret && iomap->type == IOMAP_HOLE) if (!ret && iomap->type == IOMAP_HOLE)
ret = gfs2_iomap_alloc(inode, iomap, IOMAP_WRITE, &mp); ret = gfs2_iomap_alloc(inode, iomap, &mp);
release_metapath(&mp); release_metapath(&mp);
return ret; return ret;
} }
...@@ -1864,9 +1863,8 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) ...@@ -1864,9 +1863,8 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)
gfs2_assert_withdraw(sdp, bh); gfs2_assert_withdraw(sdp, bh);
if (gfs2_assert_withdraw(sdp, if (gfs2_assert_withdraw(sdp,
prev_bnr != bh->b_blocknr)) { prev_bnr != bh->b_blocknr)) {
printk(KERN_EMERG "GFS2: fsid=%s:inode %llu, " fs_emerg(sdp, "inode %llu, block:%llu, i_h:%u,"
"block:%llu, i_h:%u, s_h:%u, mp_h:%u\n", "s_h:%u, mp_h:%u\n",
sdp->sd_fsname,
(unsigned long long)ip->i_no_addr, (unsigned long long)ip->i_no_addr,
prev_bnr, ip->i_height, strip_h, mp_h); prev_bnr, ip->i_height, strip_h, mp_h);
} }
......
...@@ -750,7 +750,7 @@ static struct gfs2_dirent *gfs2_dirent_split_alloc(struct inode *inode, ...@@ -750,7 +750,7 @@ static struct gfs2_dirent *gfs2_dirent_split_alloc(struct inode *inode,
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
gfs2_dirent_find_offset, name, ptr); gfs2_dirent_find_offset, name, ptr);
if (!dent || IS_ERR(dent)) if (IS_ERR_OR_NULL(dent))
return dent; return dent;
return do_init_dirent(inode, dent, name, bh, return do_init_dirent(inode, dent, name, bh,
(unsigned)(ptr - (void *)dent)); (unsigned)(ptr - (void *)dent));
...@@ -854,7 +854,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode, ...@@ -854,7 +854,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
return ERR_PTR(error); return ERR_PTR(error);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL); dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
got_dent: got_dent:
if (unlikely(dent == NULL || IS_ERR(dent))) { if (IS_ERR_OR_NULL(dent)) {
brelse(bh); brelse(bh);
bh = NULL; bh = NULL;
} }
......
...@@ -363,31 +363,30 @@ static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size) ...@@ -363,31 +363,30 @@ static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
} }
/** /**
* gfs2_allocate_page_backing - Use bmap to allocate blocks * gfs2_allocate_page_backing - Allocate blocks for a write fault
* @page: The (locked) page to allocate backing for * @page: The (locked) page to allocate backing for
* *
* We try to allocate all the blocks required for the page in * We try to allocate all the blocks required for the page in one go. This
* one go. This might fail for various reasons, so we keep * might fail for various reasons, so we keep trying until all the blocks to
* trying until all the blocks to back this page are allocated. * back this page are allocated. If some of the blocks are already allocated,
* If some of the blocks are already allocated, thats ok too. * that is ok too.
*/ */
static int gfs2_allocate_page_backing(struct page *page) static int gfs2_allocate_page_backing(struct page *page)
{ {
struct inode *inode = page->mapping->host; u64 pos = page_offset(page);
struct buffer_head bh; u64 size = PAGE_SIZE;
unsigned long size = PAGE_SIZE;
u64 lblock = page->index << (PAGE_SHIFT - inode->i_blkbits);
do { do {
bh.b_state = 0; struct iomap iomap = { };
bh.b_size = size;
gfs2_block_map(inode, lblock, &bh, 1); if (gfs2_iomap_get_alloc(page->mapping->host, pos, 1, &iomap))
if (!buffer_mapped(&bh))
return -EIO; return -EIO;
size -= bh.b_size;
lblock += (bh.b_size >> inode->i_blkbits); iomap.length = min(iomap.length, size);
} while(size > 0); size -= iomap.length;
pos += iomap.length;
} while (size > 0);
return 0; return 0;
} }
...@@ -408,7 +407,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf) ...@@ -408,7 +407,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf)
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
struct gfs2_alloc_parms ap = { .aflags = 0, }; struct gfs2_alloc_parms ap = { .aflags = 0, };
unsigned long last_index; unsigned long last_index;
u64 pos = page->index << PAGE_SHIFT; u64 pos = page_offset(page);
unsigned int data_blocks, ind_blocks, rblocks; unsigned int data_blocks, ind_blocks, rblocks;
struct gfs2_holder gh; struct gfs2_holder gh;
loff_t size; loff_t size;
...@@ -1166,7 +1165,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -1166,7 +1165,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
cmd = F_SETLK; cmd = F_SETLK;
fl->fl_type = F_UNLCK; fl->fl_type = F_UNLCK;
} }
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
if (fl->fl_type == F_UNLCK) if (fl->fl_type == F_UNLCK)
locks_lock_file_wait(file, fl); locks_lock_file_wait(file, fl);
return -EIO; return -EIO;
......
...@@ -544,7 +544,7 @@ __acquires(&gl->gl_lockref.lock) ...@@ -544,7 +544,7 @@ __acquires(&gl->gl_lockref.lock)
unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0); unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0);
int ret; int ret;
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) && if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) &&
target != LM_ST_UNLOCKED) target != LM_ST_UNLOCKED)
return; return;
lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP |
...@@ -581,7 +581,7 @@ __acquires(&gl->gl_lockref.lock) ...@@ -581,7 +581,7 @@ __acquires(&gl->gl_lockref.lock)
} }
else if (ret) { else if (ret) {
fs_err(sdp, "lm_lock ret %d\n", ret); fs_err(sdp, "lm_lock ret %d\n", ret);
GLOCK_BUG_ON(gl, !test_bit(SDF_SHUTDOWN, GLOCK_BUG_ON(gl, !test_bit(SDF_WITHDRAWN,
&sdp->sd_flags)); &sdp->sd_flags));
} }
} else { /* lock_nolock */ } else { /* lock_nolock */
...@@ -681,7 +681,7 @@ static void delete_work_func(struct work_struct *work) ...@@ -681,7 +681,7 @@ static void delete_work_func(struct work_struct *work)
goto out; goto out;
inode = gfs2_lookup_by_inum(sdp, no_addr, NULL, GFS2_BLKST_UNLINKED); inode = gfs2_lookup_by_inum(sdp, no_addr, NULL, GFS2_BLKST_UNLINKED);
if (inode && !IS_ERR(inode)) { if (!IS_ERR_OR_NULL(inode)) {
d_prune_aliases(inode); d_prune_aliases(inode);
iput(inode); iput(inode);
} }
...@@ -1075,7 +1075,7 @@ __acquires(&gl->gl_lockref.lock) ...@@ -1075,7 +1075,7 @@ __acquires(&gl->gl_lockref.lock)
fs_err(sdp, "pid: %d\n", pid_nr(gh->gh_owner_pid)); fs_err(sdp, "pid: %d\n", pid_nr(gh->gh_owner_pid));
fs_err(sdp, "lock type: %d req lock state : %d\n", fs_err(sdp, "lock type: %d req lock state : %d\n",
gh->gh_gl->gl_name.ln_type, gh->gh_state); gh->gh_gl->gl_name.ln_type, gh->gh_state);
gfs2_dump_glock(NULL, gl); gfs2_dump_glock(NULL, gl, true);
BUG(); BUG();
} }
...@@ -1094,7 +1094,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh) ...@@ -1094,7 +1094,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
int error = 0; int error = 0;
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
return -EIO; return -EIO;
if (test_bit(GLF_LRU, &gl->gl_flags)) if (test_bit(GLF_LRU, &gl->gl_flags))
...@@ -1610,16 +1610,16 @@ void gfs2_glock_thaw(struct gfs2_sbd *sdp) ...@@ -1610,16 +1610,16 @@ void gfs2_glock_thaw(struct gfs2_sbd *sdp)
glock_hash_walk(thaw_glock, sdp); glock_hash_walk(thaw_glock, sdp);
} }
static void dump_glock(struct seq_file *seq, struct gfs2_glock *gl) static void dump_glock(struct seq_file *seq, struct gfs2_glock *gl, bool fsid)
{ {
spin_lock(&gl->gl_lockref.lock); spin_lock(&gl->gl_lockref.lock);
gfs2_dump_glock(seq, gl); gfs2_dump_glock(seq, gl, fsid);
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
} }
static void dump_glock_func(struct gfs2_glock *gl) static void dump_glock_func(struct gfs2_glock *gl)
{ {
dump_glock(NULL, gl); dump_glock(NULL, gl, true);
} }
/** /**
...@@ -1704,10 +1704,12 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags) ...@@ -1704,10 +1704,12 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
* dump_holder - print information about a glock holder * dump_holder - print information about a glock holder
* @seq: the seq_file struct * @seq: the seq_file struct
* @gh: the glock holder * @gh: the glock holder
* @fs_id_buf: pointer to file system id (if requested)
* *
*/ */
static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh,
const char *fs_id_buf)
{ {
struct task_struct *gh_owner = NULL; struct task_struct *gh_owner = NULL;
char flags_buf[32]; char flags_buf[32];
...@@ -1715,8 +1717,8 @@ static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) ...@@ -1715,8 +1717,8 @@ static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
rcu_read_lock(); rcu_read_lock();
if (gh->gh_owner_pid) if (gh->gh_owner_pid)
gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID); gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
gfs2_print_dbg(seq, " H: s:%s f:%s e:%d p:%ld [%s] %pS\n", gfs2_print_dbg(seq, "%s H: s:%s f:%s e:%d p:%ld [%s] %pS\n",
state2str(gh->gh_state), fs_id_buf, state2str(gh->gh_state),
hflags2str(flags_buf, gh->gh_flags, gh->gh_iflags), hflags2str(flags_buf, gh->gh_flags, gh->gh_iflags),
gh->gh_error, gh->gh_error,
gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1, gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1,
...@@ -1766,6 +1768,7 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl) ...@@ -1766,6 +1768,7 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
* gfs2_dump_glock - print information about a glock * gfs2_dump_glock - print information about a glock
* @seq: The seq_file struct * @seq: The seq_file struct
* @gl: the glock * @gl: the glock
* @fsid: If true, also dump the file system id
* *
* The file format is as follows: * The file format is as follows:
* One line per object, capital letters are used to indicate objects * One line per object, capital letters are used to indicate objects
...@@ -1779,19 +1782,24 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl) ...@@ -1779,19 +1782,24 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
* *
*/ */
void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl) void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl, bool fsid)
{ {
const struct gfs2_glock_operations *glops = gl->gl_ops; const struct gfs2_glock_operations *glops = gl->gl_ops;
unsigned long long dtime; unsigned long long dtime;
const struct gfs2_holder *gh; const struct gfs2_holder *gh;
char gflags_buf[32]; char gflags_buf[32];
char fs_id_buf[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2];
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
memset(fs_id_buf, 0, sizeof(fs_id_buf));
if (fsid && sdp) /* safety precaution */
sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
dtime = jiffies - gl->gl_demote_time; dtime = jiffies - gl->gl_demote_time;
dtime *= 1000000/HZ; /* demote time in uSec */ dtime *= 1000000/HZ; /* demote time in uSec */
if (!test_bit(GLF_DEMOTE, &gl->gl_flags)) if (!test_bit(GLF_DEMOTE, &gl->gl_flags))
dtime = 0; dtime = 0;
gfs2_print_dbg(seq, "G: s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d v:%d r:%d m:%ld\n", gfs2_print_dbg(seq, "%sG: s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d "
state2str(gl->gl_state), "v:%d r:%d m:%ld\n", fs_id_buf, state2str(gl->gl_state),
gl->gl_name.ln_type, gl->gl_name.ln_type,
(unsigned long long)gl->gl_name.ln_number, (unsigned long long)gl->gl_name.ln_number,
gflags2str(gflags_buf, gl), gflags2str(gflags_buf, gl),
...@@ -1802,10 +1810,10 @@ void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl) ...@@ -1802,10 +1810,10 @@ void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl)
(int)gl->gl_lockref.count, gl->gl_hold_time); (int)gl->gl_lockref.count, gl->gl_hold_time);
list_for_each_entry(gh, &gl->gl_holders, gh_list) list_for_each_entry(gh, &gl->gl_holders, gh_list)
dump_holder(seq, gh); dump_holder(seq, gh, fs_id_buf);
if (gl->gl_state != LM_ST_UNLOCKED && glops->go_dump) if (gl->gl_state != LM_ST_UNLOCKED && glops->go_dump)
glops->go_dump(seq, gl); glops->go_dump(seq, gl, fs_id_buf);
} }
static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr) static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr)
...@@ -2006,7 +2014,7 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr) ...@@ -2006,7 +2014,7 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
{ {
dump_glock(seq, iter_ptr); dump_glock(seq, iter_ptr, false);
return 0; return 0;
} }
......
...@@ -199,8 +199,11 @@ extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number, ...@@ -199,8 +199,11 @@ extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
struct gfs2_holder *gh); struct gfs2_holder *gh);
extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs); extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
extern void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl); extern void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl,
#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0) bool fsid);
#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { \
gfs2_dump_glock(NULL, gl, true); \
BUG(); } } while(0)
extern __printf(2, 3) extern __printf(2, 3)
void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...); void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...);
...@@ -266,7 +269,7 @@ static inline void glock_set_object(struct gfs2_glock *gl, void *object) ...@@ -266,7 +269,7 @@ static inline void glock_set_object(struct gfs2_glock *gl, void *object)
{ {
spin_lock(&gl->gl_lockref.lock); spin_lock(&gl->gl_lockref.lock);
if (gfs2_assert_warn(gl->gl_name.ln_sbd, gl->gl_object == NULL)) if (gfs2_assert_warn(gl->gl_name.ln_sbd, gl->gl_object == NULL))
gfs2_dump_glock(NULL, gl); gfs2_dump_glock(NULL, gl, true);
gl->gl_object = object; gl->gl_object = object;
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
} }
...@@ -278,7 +281,7 @@ static inline void glock_set_object(struct gfs2_glock *gl, void *object) ...@@ -278,7 +281,7 @@ static inline void glock_set_object(struct gfs2_glock *gl, void *object)
* *
* I'd love to similarly add this: * I'd love to similarly add this:
* else if (gfs2_assert_warn(gl->gl_sbd, gl->gl_object == object)) * else if (gfs2_assert_warn(gl->gl_sbd, gl->gl_object == object))
* gfs2_dump_glock(NULL, gl); * gfs2_dump_glock(NULL, gl, true);
* Unfortunately, that's not possible because as soon as gfs2_delete_inode * Unfortunately, that's not possible because as soon as gfs2_delete_inode
* frees the block in the rgrp, another process can reassign it for an I_NEW * frees the block in the rgrp, another process can reassign it for an I_NEW
* inode in gfs2_create_inode because that calls new_inode, not gfs2_iget. * inode in gfs2_create_inode because that calls new_inode, not gfs2_iget.
......
...@@ -461,10 +461,12 @@ static int inode_go_lock(struct gfs2_holder *gh) ...@@ -461,10 +461,12 @@ static int inode_go_lock(struct gfs2_holder *gh)
* inode_go_dump - print information about an inode * inode_go_dump - print information about an inode
* @seq: The iterator * @seq: The iterator
* @ip: the inode * @ip: the inode
* @fs_id_buf: file system id (may be empty)
* *
*/ */
static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl) static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
const char *fs_id_buf)
{ {
struct gfs2_inode *ip = gl->gl_object; struct gfs2_inode *ip = gl->gl_object;
struct inode *inode = &ip->i_inode; struct inode *inode = &ip->i_inode;
...@@ -477,7 +479,8 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl) ...@@ -477,7 +479,8 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl)
nrpages = inode->i_data.nrpages; nrpages = inode->i_data.nrpages;
xa_unlock_irq(&inode->i_data.i_pages); xa_unlock_irq(&inode->i_data.i_pages);
gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu p:%lu\n", gfs2_print_dbg(seq, "%s I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu "
"p:%lu\n", fs_id_buf,
(unsigned long long)ip->i_no_formal_ino, (unsigned long long)ip->i_no_formal_ino,
(unsigned long long)ip->i_no_addr, (unsigned long long)ip->i_no_addr,
IF2DT(ip->i_inode.i_mode), ip->i_flags, IF2DT(ip->i_inode.i_mode), ip->i_flags,
...@@ -503,7 +506,8 @@ static void freeze_go_sync(struct gfs2_glock *gl) ...@@ -503,7 +506,8 @@ static void freeze_go_sync(struct gfs2_glock *gl)
atomic_set(&sdp->sd_freeze_state, SFS_STARTING_FREEZE); atomic_set(&sdp->sd_freeze_state, SFS_STARTING_FREEZE);
error = freeze_super(sdp->sd_vfs); error = freeze_super(sdp->sd_vfs);
if (error) { if (error) {
printk(KERN_INFO "GFS2: couldn't freeze filesystem: %d\n", error); fs_info(sdp, "GFS2: couldn't freeze filesystem: %d\n",
error);
gfs2_assert_withdraw(sdp, 0); gfs2_assert_withdraw(sdp, 0);
} }
queue_work(gfs2_freeze_wq, &sdp->sd_freeze_work); queue_work(gfs2_freeze_wq, &sdp->sd_freeze_work);
...@@ -536,7 +540,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) ...@@ -536,7 +540,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
gfs2_consist(sdp); gfs2_consist(sdp);
/* Initialize some head of the log stuff */ /* Initialize some head of the log stuff */
if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) { if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
sdp->sd_log_sequence = head.lh_sequence + 1; sdp->sd_log_sequence = head.lh_sequence + 1;
gfs2_log_pointers_init(sdp, head.lh_blkno); gfs2_log_pointers_init(sdp, head.lh_blkno);
} }
......
...@@ -240,7 +240,8 @@ struct gfs2_glock_operations { ...@@ -240,7 +240,8 @@ struct gfs2_glock_operations {
int (*go_demote_ok) (const struct gfs2_glock *gl); int (*go_demote_ok) (const struct gfs2_glock *gl);
int (*go_lock) (struct gfs2_holder *gh); int (*go_lock) (struct gfs2_holder *gh);
void (*go_unlock) (struct gfs2_holder *gh); void (*go_unlock) (struct gfs2_holder *gh);
void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl); void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl,
const char *fs_id_buf);
void (*go_callback)(struct gfs2_glock *gl, bool remote); void (*go_callback)(struct gfs2_glock *gl, bool remote);
const int go_type; const int go_type;
const unsigned long go_flags; const unsigned long go_flags;
...@@ -504,7 +505,6 @@ struct gfs2_trans { ...@@ -504,7 +505,6 @@ struct gfs2_trans {
unsigned int tr_num_buf_rm; unsigned int tr_num_buf_rm;
unsigned int tr_num_databuf_rm; unsigned int tr_num_databuf_rm;
unsigned int tr_num_revoke; unsigned int tr_num_revoke;
unsigned int tr_num_revoke_rm;
struct list_head tr_list; struct list_head tr_list;
struct list_head tr_databuf; struct list_head tr_databuf;
...@@ -609,7 +609,7 @@ struct gfs2_tune { ...@@ -609,7 +609,7 @@ struct gfs2_tune {
enum { enum {
SDF_JOURNAL_CHECKED = 0, SDF_JOURNAL_CHECKED = 0,
SDF_JOURNAL_LIVE = 1, SDF_JOURNAL_LIVE = 1,
SDF_SHUTDOWN = 2, SDF_WITHDRAWN = 2,
SDF_NOBARRIERS = 3, SDF_NOBARRIERS = 3,
SDF_NORECOVERY = 4, SDF_NORECOVERY = 4,
SDF_DEMOTE = 5, SDF_DEMOTE = 5,
......
...@@ -793,7 +793,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ...@@ -793,7 +793,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
fail_gunlock: fail_gunlock:
gfs2_dir_no_add(&da); gfs2_dir_no_add(&da);
gfs2_glock_dq_uninit(ghs); gfs2_glock_dq_uninit(ghs);
if (inode && !IS_ERR(inode)) { if (!IS_ERR_OR_NULL(inode)) {
clear_nlink(inode); clear_nlink(inode);
if (!free_vfs_inode) if (!free_vfs_inode)
mark_inode_dirty(inode); mark_inode_dirty(inode);
......
...@@ -882,7 +882,6 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) ...@@ -882,7 +882,6 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new)
old->tr_num_buf_rm += new->tr_num_buf_rm; old->tr_num_buf_rm += new->tr_num_buf_rm;
old->tr_num_databuf_rm += new->tr_num_databuf_rm; old->tr_num_databuf_rm += new->tr_num_databuf_rm;
old->tr_num_revoke += new->tr_num_revoke; old->tr_num_revoke += new->tr_num_revoke;
old->tr_num_revoke_rm += new->tr_num_revoke_rm;
list_splice_tail_init(&new->tr_databuf, &old->tr_databuf); list_splice_tail_init(&new->tr_databuf, &old->tr_databuf);
list_splice_tail_init(&new->tr_buf, &old->tr_buf); list_splice_tail_init(&new->tr_buf, &old->tr_buf);
...@@ -904,7 +903,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) ...@@ -904,7 +903,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
set_bit(TR_ATTACHED, &tr->tr_flags); set_bit(TR_ATTACHED, &tr->tr_flags);
} }
sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm; sdp->sd_log_commited_revoke += tr->tr_num_revoke;
reserved = calc_reserved(sdp); reserved = calc_reserved(sdp);
maxres = sdp->sd_log_blks_reserved + tr->tr_reserved; maxres = sdp->sd_log_blks_reserved + tr->tr_reserved;
gfs2_assert_withdraw(sdp, maxres >= reserved); gfs2_assert_withdraw(sdp, maxres >= reserved);
......
...@@ -759,9 +759,27 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start, ...@@ -759,9 +759,27 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
if (gfs2_meta_check(sdp, bh_ip)) if (gfs2_meta_check(sdp, bh_ip))
error = -EIO; error = -EIO;
else else {
struct gfs2_meta_header *mh =
(struct gfs2_meta_header *)bh_ip->b_data;
if (mh->mh_type == cpu_to_be32(GFS2_METATYPE_RG)) {
struct gfs2_rgrpd *rgd;
rgd = gfs2_blk2rgrpd(sdp, blkno, false);
if (rgd && rgd->rd_addr == blkno &&
rgd->rd_bits && rgd->rd_bits->bi_bh) {
fs_info(sdp, "Replaying 0x%llx but we "
"already have a bh!\n",
(unsigned long long)blkno);
fs_info(sdp, "busy:%d, pinned:%d\n",
buffer_busy(rgd->rd_bits->bi_bh) ? 1 : 0,
buffer_pinned(rgd->rd_bits->bi_bh));
gfs2_dump_glock(NULL, rgd->rd_gl, true);
}
}
mark_buffer_dirty(bh_ip); mark_buffer_dirty(bh_ip);
}
brelse(bh_log); brelse(bh_log);
brelse(bh_ip); brelse(bh_ip);
......
...@@ -251,7 +251,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, ...@@ -251,7 +251,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
struct buffer_head *bh, *bhs[2]; struct buffer_head *bh, *bhs[2];
int num = 0; int num = 0;
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
*bhp = NULL; *bhp = NULL;
return -EIO; return -EIO;
} }
...@@ -309,7 +309,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, ...@@ -309,7 +309,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh) int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
{ {
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
return -EIO; return -EIO;
wait_on_buffer(bh); wait_on_buffer(bh);
...@@ -320,7 +320,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh) ...@@ -320,7 +320,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
gfs2_io_error_bh_wd(sdp, bh); gfs2_io_error_bh_wd(sdp, bh);
return -EIO; return -EIO;
} }
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
return -EIO; return -EIO;
return 0; return 0;
......
...@@ -61,6 +61,13 @@ static void gfs2_tune_init(struct gfs2_tune *gt) ...@@ -61,6 +61,13 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
gt->gt_complain_secs = 10; gt->gt_complain_secs = 10;
} }
void free_sbd(struct gfs2_sbd *sdp)
{
if (sdp->sd_lkstats)
free_percpu(sdp->sd_lkstats);
kfree(sdp);
}
static struct gfs2_sbd *init_sbd(struct super_block *sb) static struct gfs2_sbd *init_sbd(struct super_block *sb)
{ {
struct gfs2_sbd *sdp; struct gfs2_sbd *sdp;
...@@ -72,10 +79,8 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) ...@@ -72,10 +79,8 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
sdp->sd_vfs = sb; sdp->sd_vfs = sb;
sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats); sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats);
if (!sdp->sd_lkstats) { if (!sdp->sd_lkstats)
kfree(sdp); goto fail;
return NULL;
}
sb->s_fs_info = sdp; sb->s_fs_info = sdp;
set_bit(SDF_NOJOURNALID, &sdp->sd_flags); set_bit(SDF_NOJOURNALID, &sdp->sd_flags);
...@@ -134,8 +139,11 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) ...@@ -134,8 +139,11 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
mutex_init(&sdp->sd_freeze_mutex); mutex_init(&sdp->sd_freeze_mutex);
return sdp; return sdp;
}
fail:
free_sbd(sdp);
return NULL;
}
/** /**
* gfs2_check_sb - Check superblock * gfs2_check_sb - Check superblock
...@@ -568,7 +576,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) ...@@ -568,7 +576,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
INIT_WORK(&jd->jd_work, gfs2_recover_func); INIT_WORK(&jd->jd_work, gfs2_recover_func);
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 (IS_ERR_OR_NULL(jd->jd_inode)) {
if (!jd->jd_inode) if (!jd->jd_inode)
error = -ENOENT; error = -ENOENT;
else else
...@@ -996,7 +1004,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent) ...@@ -996,7 +1004,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
void gfs2_lm_unmount(struct gfs2_sbd *sdp) void gfs2_lm_unmount(struct gfs2_sbd *sdp)
{ {
const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops; const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops;
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) && if (likely(!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) &&
lm->lm_unmount) lm->lm_unmount)
lm->lm_unmount(sdp); lm->lm_unmount(sdp);
} }
...@@ -1086,8 +1094,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent ...@@ -1086,8 +1094,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
if (error) { if (error) {
/* In this case, we haven't initialized sysfs, so we have to /* In this case, we haven't initialized sysfs, so we have to
manually free the sdp. */ manually free the sdp. */
free_percpu(sdp->sd_lkstats); free_sbd(sdp);
kfree(sdp);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
return error; return error;
} }
...@@ -1190,7 +1197,6 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent ...@@ -1190,7 +1197,6 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
gfs2_lm_unmount(sdp); gfs2_lm_unmount(sdp);
fail_debug: fail_debug:
gfs2_delete_debugfs_file(sdp); gfs2_delete_debugfs_file(sdp);
free_percpu(sdp->sd_lkstats);
/* gfs2_sys_fs_del must be the last thing we do, since it causes /* gfs2_sys_fs_del must be the last thing we do, since it causes
* sysfs to call function gfs2_sbd_release, which frees sdp. */ * sysfs to call function gfs2_sbd_release, which frees sdp. */
gfs2_sys_fs_del(sdp); gfs2_sys_fs_del(sdp);
...@@ -1370,7 +1376,6 @@ static void gfs2_kill_sb(struct super_block *sb) ...@@ -1370,7 +1376,6 @@ static void gfs2_kill_sb(struct super_block *sb)
sdp->sd_root_dir = NULL; sdp->sd_root_dir = NULL;
sdp->sd_master_dir = NULL; sdp->sd_master_dir = NULL;
shrink_dcache_sb(sb); shrink_dcache_sb(sb);
free_percpu(sdp->sd_lkstats);
kill_block_super(sb); kill_block_super(sb);
} }
......
...@@ -1475,7 +1475,7 @@ static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error) ...@@ -1475,7 +1475,7 @@ static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error)
{ {
if (error == 0 || error == -EROFS) if (error == 0 || error == -EROFS)
return; return;
if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) { if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
fs_err(sdp, "gfs2_quotad: %s error %d\n", msg, error); fs_err(sdp, "gfs2_quotad: %s error %d\n", msg, error);
sdp->sd_log_error = error; sdp->sd_log_error = error;
wake_up(&sdp->sd_logd_waitq); wake_up(&sdp->sd_logd_waitq);
......
...@@ -388,7 +388,8 @@ void gfs2_recover_func(struct work_struct *work) ...@@ -388,7 +388,8 @@ void gfs2_recover_func(struct work_struct *work)
} }
t_tlck = ktime_get(); t_tlck = ktime_get();
fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid); fs_info(sdp, "jid=%u: Replaying journal...0x%x to 0x%x\n",
jd->jd_jid, head.lh_tail, head.lh_blkno);
for (pass = 0; pass < 2; pass++) { for (pass = 0; pass < 2; pass++) {
lops_before_scan(jd, &head, pass); lops_before_scan(jd, &head, pass);
......
...@@ -610,11 +610,12 @@ int gfs2_rsqa_alloc(struct gfs2_inode *ip) ...@@ -610,11 +610,12 @@ int gfs2_rsqa_alloc(struct gfs2_inode *ip)
return gfs2_qa_alloc(ip); return gfs2_qa_alloc(ip);
} }
static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs,
const char *fs_id_buf)
{ {
struct gfs2_inode *ip = container_of(rs, struct gfs2_inode, i_res); struct gfs2_inode *ip = container_of(rs, struct gfs2_inode, i_res);
gfs2_print_dbg(seq, " B: n:%llu s:%llu b:%u f:%u\n", gfs2_print_dbg(seq, "%s B: n:%llu s:%llu b:%u f:%u\n", fs_id_buf,
(unsigned long long)ip->i_no_addr, (unsigned long long)ip->i_no_addr,
(unsigned long long)gfs2_rbm_to_block(&rs->rs_rbm), (unsigned long long)gfs2_rbm_to_block(&rs->rs_rbm),
rs->rs_rbm.offset, rs->rs_free); rs->rs_rbm.offset, rs->rs_free);
...@@ -1111,32 +1112,33 @@ static int gfs2_rgrp_lvb_valid(struct gfs2_rgrpd *rgd) ...@@ -1111,32 +1112,33 @@ static int gfs2_rgrp_lvb_valid(struct gfs2_rgrpd *rgd)
{ {
struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl; struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl;
struct gfs2_rgrp *str = (struct gfs2_rgrp *)rgd->rd_bits[0].bi_bh->b_data; struct gfs2_rgrp *str = (struct gfs2_rgrp *)rgd->rd_bits[0].bi_bh->b_data;
struct gfs2_sbd *sdp = rgd->rd_sbd;
int valid = 1; int valid = 1;
if (rgl->rl_flags != str->rg_flags) { if (rgl->rl_flags != str->rg_flags) {
printk(KERN_WARNING "GFS2: rgd: %llu lvb flag mismatch %u/%u", fs_warn(sdp, "GFS2: rgd: %llu lvb flag mismatch %u/%u",
(unsigned long long)rgd->rd_addr, (unsigned long long)rgd->rd_addr,
be32_to_cpu(rgl->rl_flags), be32_to_cpu(str->rg_flags)); be32_to_cpu(rgl->rl_flags), be32_to_cpu(str->rg_flags));
valid = 0; valid = 0;
} }
if (rgl->rl_free != str->rg_free) { if (rgl->rl_free != str->rg_free) {
printk(KERN_WARNING "GFS2: rgd: %llu lvb free mismatch %u/%u", fs_warn(sdp, "GFS2: rgd: %llu lvb free mismatch %u/%u",
(unsigned long long)rgd->rd_addr, (unsigned long long)rgd->rd_addr,
be32_to_cpu(rgl->rl_free), be32_to_cpu(str->rg_free)); be32_to_cpu(rgl->rl_free), be32_to_cpu(str->rg_free));
valid = 0; valid = 0;
} }
if (rgl->rl_dinodes != str->rg_dinodes) { if (rgl->rl_dinodes != str->rg_dinodes) {
printk(KERN_WARNING "GFS2: rgd: %llu lvb dinode mismatch %u/%u", fs_warn(sdp, "GFS2: rgd: %llu lvb dinode mismatch %u/%u",
(unsigned long long)rgd->rd_addr, (unsigned long long)rgd->rd_addr,
be32_to_cpu(rgl->rl_dinodes), be32_to_cpu(rgl->rl_dinodes),
be32_to_cpu(str->rg_dinodes)); be32_to_cpu(str->rg_dinodes));
valid = 0; valid = 0;
} }
if (rgl->rl_igeneration != str->rg_igeneration) { if (rgl->rl_igeneration != str->rg_igeneration) {
printk(KERN_WARNING "GFS2: rgd: %llu lvb igen mismatch " fs_warn(sdp, "GFS2: rgd: %llu lvb igen mismatch %llu/%llu",
"%llu/%llu", (unsigned long long)rgd->rd_addr, (unsigned long long)rgd->rd_addr,
(unsigned long long)be64_to_cpu(rgl->rl_igeneration), (unsigned long long)be64_to_cpu(rgl->rl_igeneration),
(unsigned long long)be64_to_cpu(str->rg_igeneration)); (unsigned long long)be64_to_cpu(str->rg_igeneration));
valid = 0; valid = 0;
} }
return valid; return valid;
...@@ -2246,10 +2248,12 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd, ...@@ -2246,10 +2248,12 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd,
* gfs2_rgrp_dump - print out an rgrp * gfs2_rgrp_dump - print out an rgrp
* @seq: The iterator * @seq: The iterator
* @gl: The glock in question * @gl: The glock in question
* @fs_id_buf: pointer to file system id (if requested)
* *
*/ */
void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl) void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl,
const char *fs_id_buf)
{ {
struct gfs2_rgrpd *rgd = gl->gl_object; struct gfs2_rgrpd *rgd = gl->gl_object;
struct gfs2_blkreserv *trs; struct gfs2_blkreserv *trs;
...@@ -2257,14 +2261,15 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl) ...@@ -2257,14 +2261,15 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl)
if (rgd == NULL) if (rgd == NULL)
return; return;
gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u r:%u e:%u\n", gfs2_print_dbg(seq, "%s R: n:%llu f:%02x b:%u/%u i:%u r:%u e:%u\n",
fs_id_buf,
(unsigned long long)rgd->rd_addr, rgd->rd_flags, (unsigned long long)rgd->rd_addr, rgd->rd_flags,
rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes, rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes,
rgd->rd_reserved, rgd->rd_extfail_pt); rgd->rd_reserved, rgd->rd_extfail_pt);
if (rgd->rd_sbd->sd_args.ar_rgrplvb) { if (rgd->rd_sbd->sd_args.ar_rgrplvb) {
struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl; struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl;
gfs2_print_dbg(seq, " L: f:%02x b:%u i:%u\n", gfs2_print_dbg(seq, "%s L: f:%02x b:%u i:%u\n", fs_id_buf,
be32_to_cpu(rgl->rl_flags), be32_to_cpu(rgl->rl_flags),
be32_to_cpu(rgl->rl_free), be32_to_cpu(rgl->rl_free),
be32_to_cpu(rgl->rl_dinodes)); be32_to_cpu(rgl->rl_dinodes));
...@@ -2272,7 +2277,7 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl) ...@@ -2272,7 +2277,7 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl)
spin_lock(&rgd->rd_rsspin); spin_lock(&rgd->rd_rsspin);
for (n = rb_first(&rgd->rd_rstree); n; n = rb_next(&trs->rs_node)) { for (n = rb_first(&rgd->rd_rstree); n; n = rb_next(&trs->rs_node)) {
trs = rb_entry(n, struct gfs2_blkreserv, rs_node); trs = rb_entry(n, struct gfs2_blkreserv, rs_node);
dump_rs(seq, trs); dump_rs(seq, trs, fs_id_buf);
} }
spin_unlock(&rgd->rd_rsspin); spin_unlock(&rgd->rd_rsspin);
} }
...@@ -2280,10 +2285,13 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl) ...@@ -2280,10 +2285,13 @@ void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl)
static void gfs2_rgrp_error(struct gfs2_rgrpd *rgd) static void gfs2_rgrp_error(struct gfs2_rgrpd *rgd)
{ {
struct gfs2_sbd *sdp = rgd->rd_sbd; struct gfs2_sbd *sdp = rgd->rd_sbd;
char fs_id_buf[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2];
fs_warn(sdp, "rgrp %llu has an error, marking it readonly until umount\n", fs_warn(sdp, "rgrp %llu has an error, marking it readonly until umount\n",
(unsigned long long)rgd->rd_addr); (unsigned long long)rgd->rd_addr);
fs_warn(sdp, "umount on all nodes and run fsck.gfs2 to fix the error\n"); fs_warn(sdp, "umount on all nodes and run fsck.gfs2 to fix the error\n");
gfs2_rgrp_dump(NULL, rgd->rd_gl); sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
gfs2_rgrp_dump(NULL, rgd->rd_gl, fs_id_buf);
rgd->rd_flags |= GFS2_RDF_ERROR; rgd->rd_flags |= GFS2_RDF_ERROR;
} }
......
...@@ -69,7 +69,8 @@ extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, ...@@ -69,7 +69,8 @@ extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist); extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist);
extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl); extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl,
const char *fs_id_buf);
extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
struct buffer_head *bh, struct buffer_head *bh,
const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed); const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed);
......
...@@ -394,6 +394,7 @@ static int init_threads(struct gfs2_sbd *sdp) ...@@ -394,6 +394,7 @@ static int init_threads(struct gfs2_sbd *sdp)
fail: fail:
kthread_stop(sdp->sd_logd_process); kthread_stop(sdp->sd_logd_process);
sdp->sd_logd_process = NULL;
return error; return error;
} }
...@@ -451,8 +452,12 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) ...@@ -451,8 +452,12 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
freeze_gh.gh_flags |= GL_NOCACHE; freeze_gh.gh_flags |= GL_NOCACHE;
gfs2_glock_dq_uninit(&freeze_gh); gfs2_glock_dq_uninit(&freeze_gh);
fail_threads: fail_threads:
kthread_stop(sdp->sd_quotad_process); if (sdp->sd_quotad_process)
kthread_stop(sdp->sd_logd_process); kthread_stop(sdp->sd_quotad_process);
sdp->sd_quotad_process = NULL;
if (sdp->sd_logd_process)
kthread_stop(sdp->sd_logd_process);
sdp->sd_logd_process = NULL;
return error; return error;
} }
...@@ -800,7 +805,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags) ...@@ -800,7 +805,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
if (!(flags & I_DIRTY_INODE)) if (!(flags & I_DIRTY_INODE))
return; return;
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
return; return;
if (!gfs2_glock_is_locked_by_me(ip->i_gl)) { if (!gfs2_glock_is_locked_by_me(ip->i_gl)) {
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
...@@ -849,12 +854,16 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) ...@@ -849,12 +854,16 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, GL_NOCACHE, error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, GL_NOCACHE,
&freeze_gh); &freeze_gh);
if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) if (error && !test_bit(SDF_WITHDRAWN, &sdp->sd_flags))
return error; return error;
flush_workqueue(gfs2_delete_workqueue); flush_workqueue(gfs2_delete_workqueue);
kthread_stop(sdp->sd_quotad_process); if (sdp->sd_quotad_process)
kthread_stop(sdp->sd_logd_process); kthread_stop(sdp->sd_quotad_process);
sdp->sd_quotad_process = NULL;
if (sdp->sd_logd_process)
kthread_stop(sdp->sd_logd_process);
sdp->sd_logd_process = NULL;
gfs2_quota_sync(sdp->sd_vfs, 0); gfs2_quota_sync(sdp->sd_vfs, 0);
gfs2_statfs_sync(sdp->sd_vfs, 0); gfs2_statfs_sync(sdp->sd_vfs, 0);
...@@ -969,14 +978,14 @@ void gfs2_freeze_func(struct work_struct *work) ...@@ -969,14 +978,14 @@ void gfs2_freeze_func(struct work_struct *work)
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 0, error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 0,
&freeze_gh); &freeze_gh);
if (error) { if (error) {
printk(KERN_INFO "GFS2: couldn't get freeze lock : %d\n", error); fs_info(sdp, "GFS2: couldn't get freeze lock : %d\n", error);
gfs2_assert_withdraw(sdp, 0); gfs2_assert_withdraw(sdp, 0);
} else { } else {
atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN);
error = thaw_super(sb); error = thaw_super(sb);
if (error) { if (error) {
printk(KERN_INFO "GFS2: couldn't thaw filesystem: %d\n", fs_info(sdp, "GFS2: couldn't thaw filesystem: %d\n",
error); error);
gfs2_assert_withdraw(sdp, 0); gfs2_assert_withdraw(sdp, 0);
} }
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
...@@ -1004,7 +1013,7 @@ static int gfs2_freeze(struct super_block *sb) ...@@ -1004,7 +1013,7 @@ static int gfs2_freeze(struct super_block *sb)
if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
goto out; goto out;
if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) { if (test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} }
...@@ -1014,20 +1023,14 @@ static int gfs2_freeze(struct super_block *sb) ...@@ -1014,20 +1023,14 @@ static int gfs2_freeze(struct super_block *sb)
if (!error) if (!error)
break; break;
switch (error) { if (error == -EBUSY)
case -EBUSY:
fs_err(sdp, "waiting for recovery before freeze\n"); fs_err(sdp, "waiting for recovery before freeze\n");
break; else
default:
fs_err(sdp, "error freezing FS: %d\n", error); fs_err(sdp, "error freezing FS: %d\n", error);
break;
}
fs_err(sdp, "retrying...\n"); fs_err(sdp, "retrying...\n");
msleep(1000); msleep(1000);
} }
error = 0;
set_bit(SDF_FS_FROZEN, &sdp->sd_flags); set_bit(SDF_FS_FROZEN, &sdp->sd_flags);
out: out:
mutex_unlock(&sdp->sd_freeze_mutex); mutex_unlock(&sdp->sd_freeze_mutex);
...@@ -1273,8 +1276,6 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) ...@@ -1273,8 +1276,6 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
error = gfs2_make_fs_ro(sdp); error = gfs2_make_fs_ro(sdp);
else else
error = gfs2_make_fs_rw(sdp); error = gfs2_make_fs_rw(sdp);
if (error)
return error;
} }
sdp->sd_args = args; sdp->sd_args = args;
...@@ -1300,7 +1301,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) ...@@ -1300,7 +1301,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
spin_unlock(&gt->gt_spin); spin_unlock(&gt->gt_spin);
gfs2_online_uevent(sdp); gfs2_online_uevent(sdp);
return 0; return error;
} }
/** /**
......
...@@ -44,6 +44,8 @@ extern void update_statfs(struct gfs2_sbd *sdp, struct buffer_head *m_bh, ...@@ -44,6 +44,8 @@ extern void update_statfs(struct gfs2_sbd *sdp, struct buffer_head *m_bh,
extern int gfs2_statfs_sync(struct super_block *sb, int type); extern int gfs2_statfs_sync(struct super_block *sb, int type);
extern void gfs2_freeze_func(struct work_struct *work); extern void gfs2_freeze_func(struct work_struct *work);
extern void free_sbd(struct gfs2_sbd *sdp);
extern struct file_system_type gfs2_fs_type; extern struct file_system_type gfs2_fs_type;
extern struct file_system_type gfs2meta_fs_type; extern struct file_system_type gfs2meta_fs_type;
extern const struct export_operations gfs2_export_ops; extern const struct export_operations gfs2_export_ops;
......
...@@ -118,7 +118,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) ...@@ -118,7 +118,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
{ {
unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags); unsigned int b = test_bit(SDF_WITHDRAWN, &sdp->sd_flags);
return snprintf(buf, PAGE_SIZE, "%u\n", b); return snprintf(buf, PAGE_SIZE, "%u\n", b);
} }
...@@ -301,7 +301,7 @@ static void gfs2_sbd_release(struct kobject *kobj) ...@@ -301,7 +301,7 @@ static void gfs2_sbd_release(struct kobject *kobj)
{ {
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
kfree(sdp); free_sbd(sdp);
} }
static struct kobj_type gfs2_ktype = { static struct kobj_type gfs2_ktype = {
...@@ -679,7 +679,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) ...@@ -679,7 +679,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
fail_tune: fail_tune:
sysfs_remove_group(&sdp->sd_kobj, &tune_group); sysfs_remove_group(&sdp->sd_kobj, &tune_group);
fail_reg: fail_reg:
free_percpu(sdp->sd_lkstats);
fs_err(sdp, "error %d adding sysfs files\n", error); fs_err(sdp, "error %d adding sysfs files\n", error);
kobject_put(&sdp->sd_kobj); kobject_put(&sdp->sd_kobj);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
......
...@@ -77,10 +77,10 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr) ...@@ -77,10 +77,10 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n", fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
test_bit(TR_TOUCHED, &tr->tr_flags)); test_bit(TR_TOUCHED, &tr->tr_flags));
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u/%u\n", fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u\n",
tr->tr_num_buf_new, tr->tr_num_buf_rm, tr->tr_num_buf_new, tr->tr_num_buf_rm,
tr->tr_num_databuf_new, tr->tr_num_databuf_rm, tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
tr->tr_num_revoke, tr->tr_num_revoke_rm); tr->tr_num_revoke);
} }
void gfs2_trans_end(struct gfs2_sbd *sdp) void gfs2_trans_end(struct gfs2_sbd *sdp)
...@@ -263,7 +263,7 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) ...@@ -263,7 +263,7 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len)
gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke);
sdp->sd_log_num_revoke--; sdp->sd_log_num_revoke--;
kmem_cache_free(gfs2_bufdata_cachep, bd); kmem_cache_free(gfs2_bufdata_cachep, bd);
tr->tr_num_revoke_rm++; tr->tr_num_revoke--;
if (--n == 0) if (--n == 0)
break; break;
} }
......
...@@ -41,7 +41,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...) ...@@ -41,7 +41,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...)
struct va_format vaf; struct va_format vaf;
if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW && if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags)) test_and_set_bit(SDF_WITHDRAWN, &sdp->sd_flags))
return 0; return 0;
if (fmt) { if (fmt) {
...@@ -178,9 +178,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide, ...@@ -178,9 +178,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide,
const char *function, char *file, unsigned int line) const char *function, char *file, unsigned int line)
{ {
struct gfs2_sbd *sdp = rgd->rd_sbd; struct gfs2_sbd *sdp = rgd->rd_sbd;
char fs_id_buf[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2];
int rv; int rv;
gfs2_rgrp_dump(NULL, rgd->rd_gl); sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
gfs2_rgrp_dump(NULL, rgd->rd_gl, fs_id_buf);
rv = gfs2_lm_withdraw(sdp, rv = gfs2_lm_withdraw(sdp,
"fatal: filesystem consistency error\n" "fatal: filesystem consistency error\n"
" RG = %llu\n" " RG = %llu\n"
...@@ -256,7 +258,7 @@ void gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -256,7 +258,7 @@ void gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
const char *function, char *file, unsigned int line, const char *function, char *file, unsigned int line,
bool withdraw) bool withdraw)
{ {
if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags))
fs_err(sdp, fs_err(sdp,
"fatal: I/O error\n" "fatal: I/O error\n"
" block = %llu\n" " block = %llu\n"
......
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