From 52ae7b7935a079aaba25da98fe90772d04109f26 Mon Sep 17 00:00:00 2001 From: Russell Cattelan Date: Mon, 9 Oct 2006 12:11:54 -0500 Subject: [GFS2] Fix a size calculation error Fix a size calculation error. The size was incorrect being computed as a negative length and then being passed to an unsigned parameter. This in turn would cause the allocator to think it needed enough meta data to store a gigabyte file for every file created. Signed-off-by: Russell Cattelan Signed-off-by: Steven Whitehouse --- fs/gfs2/ops_address.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 4fb743f4e4a..bdf56cf6622 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c @@ -370,15 +370,17 @@ static int gfs2_prepare_write(struct file *file, struct page *page, loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from; loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; struct gfs2_alloc *al; + unsigned int write_len = to - from; + gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh); error = gfs2_glock_nq_m_atime(1, &ip->i_gh); if (error) goto out_uninit; - gfs2_write_calc_reserv(ip, to - from, &data_blocks, &ind_blocks); + gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks); - error = gfs2_write_alloc_required(ip, pos, from - to, &alloc_required); + error = gfs2_write_alloc_required(ip, pos, write_len, &alloc_required); if (error) goto out_unlock; -- cgit v1.2.3 From f5c54804d9e3bb23d8924af09d9ca1c8de9560b6 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Tue, 10 Oct 2006 13:45:15 -0400 Subject: [GFS2] Fix uninitialised variable This fixes a bug where, in certain cases an uninitialised variable could cause a dereference of a NULL pointer in gfs2_commit_write(). Also a typo in a comment is fixed at the same time. Signed-off-by: Steven Whitehouse --- fs/gfs2/ops_address.c | 1 + fs/gfs2/rgrp.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index bdf56cf6622..99c933762eb 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c @@ -385,6 +385,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page, goto out_unlock; + ip->i_alloc.al_requested = 0; if (alloc_required) { al = gfs2_alloc_get(ip); diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index 9eedfd12bff..b01e0cfc99b 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h @@ -32,7 +32,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd); struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); static inline void gfs2_alloc_put(struct gfs2_inode *ip) { - return; /* Se we can see where ip->i_alloc is used */ + return; /* So we can see where ip->i_alloc is used */ } int gfs2_inplace_reserve_i(struct gfs2_inode *ip, -- cgit v1.2.3 From 1ee48af22ed6dcddea8cdf93c7f2a268cbcf0d56 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 8 Oct 2006 04:30:48 +0200 Subject: [DLM] Kconfig: don't show an empty DLM menu Don't show an empty "Distributed Lock Manager" menu if IP_SCTP=n. Reported by Dmytro Bagrii in kernel Bugzilla #7268. Signed-off-by: Adrian Bunk Signed-off-by: David Teigland Signed-off-by: Patrick Caulfield Signed-off-by: Steven Whitehouse --- fs/dlm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/dlm/Kconfig b/fs/dlm/Kconfig index 490f85b3fa5..81b2c6465ee 100644 --- a/fs/dlm/Kconfig +++ b/fs/dlm/Kconfig @@ -1,10 +1,9 @@ menu "Distributed Lock Manager" - depends on INET && EXPERIMENTAL + depends on INET && IP_SCTP && EXPERIMENTAL config DLM tristate "Distributed Lock Manager (DLM)" depends on IPV6 || IPV6=n - depends on IP_SCTP select CONFIGFS_FS help A general purpose distributed lock manager for kernel or userspace -- cgit v1.2.3 From fe1a698ffef5af546dd4a8cd6a1f2f202491c4ef Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Wed, 11 Oct 2006 13:34:59 -0400 Subject: [GFS2] Fix bug where lock not held The log lock needs to be held when manipulating the counter for the number of free journal blocks. Signed-off-by: Steven Whitehouse --- fs/gfs2/log.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'fs') diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 554fe5bd1b7..72eec6542d6 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -569,16 +569,15 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle) log_write_header(sdp, 0, PULL); lops_after_commit(sdp, ai); - sdp->sd_log_head = sdp->sd_log_flush_head; + gfs2_log_lock(sdp); + sdp->sd_log_head = sdp->sd_log_flush_head; sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs; - sdp->sd_log_blks_reserved = 0; sdp->sd_log_commited_buf = 0; sdp->sd_log_num_hdrs = 0; sdp->sd_log_commited_revoke = 0; - gfs2_log_lock(sdp); if (!list_empty(&ai->ai_ail1_list)) { list_add(&ai->ai_list, &sdp->sd_ail1_list); ai = NULL; -- cgit v1.2.3 From c312c4fdc88514dd9522b7858eb879e610aeb9b1 Mon Sep 17 00:00:00 2001 From: Russell Cattelan Date: Thu, 12 Oct 2006 09:23:41 -0400 Subject: [GFS2] Pass the correct value to kunmap_atomic Pass kaddr rather than (incorrect) struct page to kunmap_atomic. Signed-off-by: Russell Cattelan Signed-off-by: Steven Whitehouse --- fs/gfs2/lops.c | 4 ++-- fs/gfs2/ops_address.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'fs') diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 881e337b6a7..ab6d1115f95 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -492,7 +492,7 @@ static int gfs2_check_magic(struct buffer_head *bh) ptr = kaddr + bh_offset(bh); if (*ptr == cpu_to_be32(GFS2_MAGIC)) rv = 1; - kunmap_atomic(page, KM_USER0); + kunmap_atomic(kaddr, KM_USER0); return rv; } @@ -626,7 +626,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) memcpy(bh->b_data, kaddr + bh_offset(bd2->bd_bh), sdp->sd_sb.sb_bsize); - kunmap_atomic(page, KM_USER0); + kunmap_atomic(kaddr, KM_USER0); *(__be32 *)bh->b_data = 0; } else { bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 99c933762eb..e0599fed99c 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c @@ -162,7 +162,7 @@ static int zero_readpage(struct page *page) kaddr = kmap_atomic(page, KM_USER0); memset(kaddr, 0, PAGE_CACHE_SIZE); - kunmap_atomic(page, KM_USER0); + kunmap_atomic(kaddr, KM_USER0); SetPageUptodate(page); @@ -195,7 +195,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), ip->i_di.di_size); memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size); - kunmap_atomic(page, KM_USER0); + kunmap_atomic(kaddr, KM_USER0); brelse(dibh); @@ -485,7 +485,7 @@ static int gfs2_commit_write(struct file *file, struct page *page, kaddr = kmap_atomic(page, KM_USER0); memcpy(dibh->b_data + sizeof(struct gfs2_dinode) + from, kaddr + from, to - from); - kunmap_atomic(page, KM_USER0); + kunmap_atomic(kaddr, KM_USER0); SetPageUptodate(page); -- cgit v1.2.3 From 4c5e1b1a8c3f591b21f09001d6748296ddff33b8 Mon Sep 17 00:00:00 2001 From: Patrick Caulfield Date: Thu, 12 Oct 2006 10:41:22 +0100 Subject: [DLM] fix iovec length in recvmsg The DLM always passes the iovec length as 1, this is wrong when the circular buffer wraps round. Signed-Off-By: Patrick Caulfield Signed-off-by: Steven Whitehouse --- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 7bcea7c5add..867f93d0417 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -548,7 +548,7 @@ static int receive_from_sock(void) } len = iov[0].iov_len + iov[1].iov_len; - r = ret = kernel_recvmsg(sctp_con.sock, &msg, iov, 1, len, + r = ret = kernel_recvmsg(sctp_con.sock, &msg, iov, msg.msg_iovlen, len, MSG_NOSIGNAL | MSG_DONTWAIT); if (ret <= 0) goto out_close; -- cgit v1.2.3