aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmdebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/dlm/dlmdebug.c')
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 18f13c2e4a10..149eb556b8c6 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -647,41 +647,30 @@ static const struct seq_operations debug_lockres_ops = {
647static int debug_lockres_open(struct inode *inode, struct file *file) 647static int debug_lockres_open(struct inode *inode, struct file *file)
648{ 648{
649 struct dlm_ctxt *dlm = inode->i_private; 649 struct dlm_ctxt *dlm = inode->i_private;
650 int ret = -ENOMEM; 650 struct debug_lockres *dl;
651 struct seq_file *seq; 651 void *buf;
652 struct debug_lockres *dl = NULL;
653 652
654 dl = kzalloc(sizeof(struct debug_lockres), GFP_KERNEL); 653 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
655 if (!dl) { 654 if (!buf)
656 mlog_errno(ret);
657 goto bail; 655 goto bail;
658 }
659 656
660 dl->dl_len = PAGE_SIZE; 657 dl = __seq_open_private(file, &debug_lockres_ops, sizeof(*dl));
661 dl->dl_buf = kmalloc(dl->dl_len, GFP_KERNEL); 658 if (!dl)
662 if (!dl->dl_buf) { 659 goto bailfree;
663 mlog_errno(ret);
664 goto bail;
665 }
666 660
667 ret = seq_open(file, &debug_lockres_ops); 661 dl->dl_len = PAGE_SIZE;
668 if (ret) { 662 dl->dl_buf = buf;
669 mlog_errno(ret);
670 goto bail;
671 }
672
673 seq = file->private_data;
674 seq->private = dl;
675 663
676 dlm_grab(dlm); 664 dlm_grab(dlm);
677 dl->dl_ctxt = dlm; 665 dl->dl_ctxt = dlm;
678 666
679 return 0; 667 return 0;
668
669bailfree:
670 kfree(buf);
680bail: 671bail:
681 if (dl) 672 mlog_errno(-ENOMEM);
682 kfree(dl->dl_buf); 673 return -ENOMEM;
683 kfree(dl);
684 return ret;
685} 674}
686 675
687static int debug_lockres_release(struct inode *inode, struct file *file) 676static int debug_lockres_release(struct inode *inode, struct file *file)