Message ID | 1360327163-20360-13-git-send-email-SteveD@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Feb 08, 2013 at 07:39:20AM -0500, Steve Dickson wrote: > From: Dave Quigley <dpquigl@taiga.selinuxproject.org> > > The nfs_setsecurity code can sleep while allocating memory > so the inode spin lock can not be held while during this call. If this is the right fix, it needs to be folded into patch 10/15, where the problem was introduced. --b. > > Signed-off-by: Steve Dickson <steved@redhat.com> > --- > fs/nfs/inode.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c > index 0d412c4..65bf9ca 100644 > --- a/fs/nfs/inode.c > +++ b/fs/nfs/inode.c > @@ -1285,6 +1285,9 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr, struct nfs4_ > status = nfs_refresh_inode_locked(inode, fattr, label); > spin_unlock(&inode->i_lock); > > + if (label && !status) > + nfs_setsecurity(inode, fattr, label); > + > return status; > } > EXPORT_SYMBOL_GPL(nfs_refresh_inode); > @@ -1324,6 +1327,10 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr, struc > spin_lock(&inode->i_lock); > status = nfs_post_op_update_inode_locked(inode, fattr, label); > spin_unlock(&inode->i_lock); > + if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { > + if (label && !status) > + nfs_setsecurity(inode, fattr, label); > + } > return status; > } > EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); > @@ -1543,9 +1550,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, struct > | NFS_INO_INVALID_ACL > | NFS_INO_REVAL_FORCED); > > - if (label && (server->caps & NFS_CAP_SECURITY_LABEL)) > - nfs_setsecurity(inode, fattr, label); > - > if (fattr->valid & NFS_ATTR_FATTR_NLINK) { > if (inode->i_nlink != fattr->nlink) { > invalid |= NFS_INO_INVALID_ATTR; > -- > 1.7.11.7 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 13/02/13 10:16, J. Bruce Fields wrote: > On Fri, Feb 08, 2013 at 07:39:20AM -0500, Steve Dickson wrote: >> > From: Dave Quigley <dpquigl@taiga.selinuxproject.org> >> > >> > The nfs_setsecurity code can sleep while allocating memory >> > so the inode spin lock can not be held while during this call. > If this is the right fix, it needs to be folded into patch 10/15, where > the problem was introduced. Gone! steved. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 0d412c4..65bf9ca 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1285,6 +1285,9 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr, struct nfs4_ status = nfs_refresh_inode_locked(inode, fattr, label); spin_unlock(&inode->i_lock); + if (label && !status) + nfs_setsecurity(inode, fattr, label); + return status; } EXPORT_SYMBOL_GPL(nfs_refresh_inode); @@ -1324,6 +1327,10 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr, struc spin_lock(&inode->i_lock); status = nfs_post_op_update_inode_locked(inode, fattr, label); spin_unlock(&inode->i_lock); + if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { + if (label && !status) + nfs_setsecurity(inode, fattr, label); + } return status; } EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); @@ -1543,9 +1550,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, struct | NFS_INO_INVALID_ACL | NFS_INO_REVAL_FORCED); - if (label && (server->caps & NFS_CAP_SECURITY_LABEL)) - nfs_setsecurity(inode, fattr, label); - if (fattr->valid & NFS_ATTR_FATTR_NLINK) { if (inode->i_nlink != fattr->nlink) { invalid |= NFS_INO_INVALID_ATTR;