@@ -287,6 +287,10 @@ void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags)
{
struct nfs4_label *label = NULL;
+ int minor_version = server->nfs_client->cl_minorversion;
+
+ if (minor_version < 2)
+ return label;
if (!(server->caps & NFS_CAP_SECURITY_LABEL))
return label;
@@ -94,6 +94,10 @@ nfs4_label_init_security(struct inode *dir, struct dentry *dentry,
struct iattr *sattr, struct nfs4_label *l)
{
int err;
+ int minor_version = NFS_SERVER(dir)->nfs_client->cl_minorversion;
+
+ if (minor_version < 2)
+ return NULL;
if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL)) {
err = security_dentry_init_security(dentry, sattr->ia_mode,