ea: fixes for named attributes

assign a superblock to named attribute files on nfs41_open(), to prevent crashing in nfs41_write()
also avoid updating the attribute cache with named attribute files on close and write

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2012-04-03 12:13:15 -04:00 committed by unknown
parent 9135e07221
commit 4e1449a2f8

View file

@ -510,9 +510,10 @@ int nfs41_open(
if (compound_error(status = compound.res.status))
goto out;
if (dir_info.type == NF4ATTRDIR)
if (dir_info.type == NF4ATTRDIR) {
file->fh.superblock = parent->fh.superblock;
goto out;
}
/* fill in the file handle's fileid and superblock */
file->fh.fileid = info->fileid;
@ -677,12 +678,14 @@ int nfs41_close(
if (compound_error(status = compound.res.status))
goto out;
if (info.type == NF4NAMEDATTR)
goto out;
/* update the attributes of the parent directory */
memcpy(&info.attrmask, &getattr_res.obj_attributes.attrmask,
sizeof(bitmap4));
nfs41_attr_cache_update(session_name_cache(session),
file->fh.fileid, &info);
out:
return status;
}
@ -755,7 +758,7 @@ int nfs41_write(
if (compound_error(status = compound.res.status))
goto out;
if (stable != UNSTABLE4) {
if (stable != UNSTABLE4 && pinfo->type != NF4NAMEDATTR) {
/* update the attribute cache */
memcpy(&pinfo->attrmask, &getattr_res.obj_attributes.attrmask,
sizeof(bitmap4));
@ -773,9 +776,6 @@ int nfs41_write(
nfs_error_string(status));
}
if (pinfo->type == NF4NAMEDATTR)
goto out;
nfs41_superblock_space_changed(file->fh.superblock);
out:
return status;