NFSv4: nfs4_open_done first must check that GETATTR decoded a file type

...before it can check the validity of that file type.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust 2012-10-02 17:09:00 -07:00
Родитель 25a1a6211d
Коммит 807d66d802
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -1537,7 +1537,8 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata)
return; return;
if (task->tk_status == 0) { if (task->tk_status == 0) {
switch (data->o_res.f_attr->mode & S_IFMT) { if (data->o_res.f_attr->valid & NFS_ATTR_FATTR_TYPE) {
switch (data->o_res.f_attr->mode & S_IFMT) {
case S_IFREG: case S_IFREG:
break; break;
case S_IFLNK: case S_IFLNK:
@ -1548,6 +1549,7 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata)
break; break;
default: default:
data->rpc_status = -ENOTDIR; data->rpc_status = -ENOTDIR;
}
} }
renew_lease(data->o_res.server, data->timestamp); renew_lease(data->o_res.server, data->timestamp);
if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)) if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM))