Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: disable reflink while creating XFS filesystems #1257

Merged
merged 2 commits into from
Jul 24, 2020

Conversation

nixpanic
Copy link
Member

Describe what this PR does

Current versions of the mkfs.xfs binary enable reflink support by
default. This causes problems on systems where the kernel does not
support this feature. When the kernel the feature does not support, but
the filesystem has it enabled, the following error is logged in dmesg:

XFS: Superblock has unknown read-only compatible features (0x4) enabled

Introduce a check to see if mkfs.xfs supports the -m reflink= option.
In case it does, pass -m reflink=0 while creating the filesystem.

The check is executed once during the first XFS filesystem creation. The
result of the check is cached until the nodeserver restarts.

Is there anything that requires special attention

By disabling reflink, PVCs with RBD+XFS will be usable on systems that have a kernel that does not support reflink (like CentOS-7). Mixing systems with new XFS (CentOS-8) and old kernels will not be a problem.

Related issues

Fixes: #966

Future concerns

Reflink is a feature that could be useful for some workloads. There is a plan to enable the feature through #1256.

@nixpanic nixpanic added bug Something isn't working component/rbd Issues related to RBD labels Jul 21, 2020
@nixpanic nixpanic requested review from humblec and Madhu-1 July 21, 2020 12:05
internal/rbd/nodeserver.go Show resolved Hide resolved
internal/rbd/nodeserver.go Outdated Show resolved Hide resolved
@Madhu-1 Madhu-1 added this to the release-3.0.0 milestone Jul 21, 2020
Current versions of the mkfs.xfs binary enable reflink support by
default. This causes problems on systems where the kernel does not
support this feature. When the kernel the feature does not support, but
the filesystem has it enabled, the following error is logged in `dmesg`:

    XFS: Superblock has unknown read-only compatible features (0x4) enabled

Introduce a check to see if mkfs.xfs supports the `-m reflink=` option.
In case it does, pass `-m reflink=0` while creating the filesystem.

The check is executed once during the first XFS filesystem creation. The
result of the check is cached until the nodeserver restarts.

Fixes: ceph#966
Signed-off-by: Niels de Vos <ndevos@redhat.com>
@Madhu-1 Madhu-1 requested a review from dillaman July 21, 2020 12:29
@Madhu-1
Copy link
Collaborator

Madhu-1 commented Jul 24, 2020

@humblec PTAL

if xfsHasReflink != xfsReflinkUnset {
return xfsHasReflink == xfsReflinkSupport
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nixpanic do we need this whitespace here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required, but it splits two parts of unrelated code:

  1. check the cached value
  2. no cache, so test for it

return true
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nixpanic do we need this whitespace here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just clean coding, I think? This is not an else statement that would follow the if

@@ -84,6 +92,10 @@ var (
Backport: true,
}, // RHEL 8.2
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nixpanic do we need this whitespace here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it is required, but splitting a multi-line variable with an empty line between the next multi-line comment looks clean to me

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in many places we dont leave a newline before multiline comment and in some places like this we do. Thats what I am trying to understand.

@nixpanic nixpanic requested a review from humblec July 24, 2020 08:34
@humblec
Copy link
Collaborator

humblec commented Jul 24, 2020

@nixpanic my small concern here is, the pattern we follow for especially for whitespace or lines in between . Some reviewers say remove it , we should have some guidelines . Otherwise its going to be messy to read through the code in different sources..etc. @Madhu-1 @ShyamsundarR thoughts?

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Jul 24, 2020

@nixpanic my small concern here is, the pattern we follow for especially for whitespace or lines in between . Some reviewers say remove it , we should have some guidelines . Otherwise its going to be messy to read through the code in different sources..etc. @Madhu-1 @ShyamsundarR thoughts?

Sure , please open an issue to add/update guidelines doc.

@nixpanic
Copy link
Member Author

my small concern here is, the pattern we follow for especially for whitespace or lines in between . Some reviewers say remove it , we should have some guidelines . Otherwise its going to be messy to read through the code in different sources..etc.

My preference strongly goes to having an empty line between sections of code; basically the place where a comment could be placed for sections that might be non-trivial to understand. Dense code is much more exhausting to read. Splitting code sections by empty lines also makes it a little easier to identify if a section could be split into its own function, making the work for maintainers a little easier.

@ShyamsundarR
Copy link
Contributor

ShyamsundarR commented Jul 24, 2020

my small concern here is, the pattern we follow for especially for whitespace or lines in between . Some reviewers say remove it , we should have some guidelines . Otherwise its going to be messy to read through the code in different sources..etc.

My preference strongly goes to having an empty line between sections of code; basically the place where a comment could be placed for sections that might be non-trivial to understand. Dense code is much more exhausting to read. Splitting code sections by empty lines also makes it a little easier to identify if a section could be split into its own function, making the work for maintainers a little easier.

I agree with @nixpanic , sections of code should be separated by a line space, allows for better redability of code.

@mergify mergify bot merged commit 47d5b60 into ceph:master Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XFS: Superblock has unknown read-only compatible features (0x4) enabled
4 participants