cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH] GFS2: check and correct zero i_goal
@ 2014-09-11 11:01 Abhi Das
  2014-09-11 11:13 ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Abhi Das @ 2014-09-11 11:01 UTC (permalink / raw)
  To: cluster-devel.redhat.com

A GFS1->GFS2 converted filesystem can have the ip->i_goal field
set to zero for inodes. This incorrect value results in -EBADSLT
when the user attempts to allocate blocks to such inodes. This
patch assigns the goal block to be the block address of the inode
itself, which serves as a reasonable starting point for the
allocation logic to find the next available block.

Resolves: rhbz#1130684
Signed-off-by: Abhi Das <adas@redhat.com>
---
 fs/gfs2/glops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 2ffc67d..799427b 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -349,6 +349,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
 	ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec);
 
 	ip->i_goal = be64_to_cpu(str->di_goal_meta);
+	if (!ip->i_goal) /* From a previous gfs2_convert, perhaps */
+		ip->i_goal = ip->i_no_addr;
+
 	ip->i_generation = be64_to_cpu(str->di_generation);
 
 	ip->i_diskflags = be32_to_cpu(str->di_flags);
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [GFS2 PATCH] GFS2: check and correct zero i_goal
  2014-09-11 11:01 [Cluster-devel] [GFS2 PATCH] GFS2: check and correct zero i_goal Abhi Das
@ 2014-09-11 11:13 ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2014-09-11 11:13 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On 11/09/14 12:01, Abhi Das wrote:
> A GFS1->GFS2 converted filesystem can have the ip->i_goal field
> set to zero for inodes. This incorrect value results in -EBADSLT
> when the user attempts to allocate blocks to such inodes. This
> patch assigns the goal block to be the block address of the inode
> itself, which serves as a reasonable starting point for the
> allocation logic to find the next available block.
>
> Resolves: rhbz#1130684
> Signed-off-by: Abhi Das <adas@redhat.com>
> ---
>   fs/gfs2/glops.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
> index 2ffc67d..799427b 100644
> --- a/fs/gfs2/glops.c
> +++ b/fs/gfs2/glops.c
> @@ -349,6 +349,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
>   	ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec);
>   
>   	ip->i_goal = be64_to_cpu(str->di_goal_meta);
> +	if (!ip->i_goal) /* From a previous gfs2_convert, perhaps */
> +		ip->i_goal = ip->i_no_addr;
> +
>   	ip->i_generation = be64_to_cpu(str->di_generation);
>   
>   	ip->i_diskflags = be32_to_cpu(str->di_flags);

I don't think that is the right place to make the change, since if the 
fs is read only then the in-kernel copy will be different to the on-disk 
copy of the inode. Better to catch the problem at block allocation time 
and use i_no_addr if i_goal is invalid then (and that doesn't just mean 
0 - it might be pointing at another "impossible" block)

Steve.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-11 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 11:01 [Cluster-devel] [GFS2 PATCH] GFS2: check and correct zero i_goal Abhi Das
2014-09-11 11:13 ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).