diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
commit | 62ab460cf5e450e1d207a98a9c6cf2e4a6a78fd1 (patch) | |
tree | 595ca70261f46b93bda1998285e5f5c7da684cbc | |
parent | a78cb57a106fceeba26da2907db9d8886700e1dc (diff) |
NFSv4: Add 'server capability' flags for NFSv4 recommended attributes
If the NFSv4 server doesn't support a POSIX attribute, the generic NFS code
needs to know that, so that it don't keep trying to poll for it.
However, by the same count, if the NFSv4 server does support that
attribute, then we should ensure that the inode metadata is appropriately
labelled as being untrusted. For instance, if we don't know the correct
value of the file's uid, we should certainly not be caching ACLs or ACCESS
results.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/client.c | 7 | ||||
-rw-r--r-- | fs/nfs/inode.c | 92 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 22 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 9 |
4 files changed, 114 insertions, 16 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 8d25ccb2d51d..8f34fd8028fc 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -809,6 +809,9 @@ static int nfs_init_server(struct nfs_server *server, | |||
809 | /* Initialise the client representation from the mount data */ | 809 | /* Initialise the client representation from the mount data */ |
810 | server->flags = data->flags; | 810 | server->flags = data->flags; |
811 | server->options = data->options; | 811 | server->options = data->options; |
812 | server->caps |= NFS_CAP_HARDLINKS|NFS_CAP_SYMLINKS|NFS_CAP_FILEID| | ||
813 | NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER|NFS_CAP_OWNER_GROUP| | ||
814 | NFS_CAP_ATIME|NFS_CAP_CTIME|NFS_CAP_MTIME; | ||
812 | 815 | ||
813 | if (data->rsize) | 816 | if (data->rsize) |
814 | server->rsize = nfs_block_size(data->rsize, NULL); | 817 | server->rsize = nfs_block_size(data->rsize, NULL); |
@@ -1274,7 +1277,7 @@ static int nfs4_init_server(struct nfs_server *server, | |||
1274 | 1277 | ||
1275 | /* Initialise the client representation from the mount data */ | 1278 | /* Initialise the client representation from the mount data */ |
1276 | server->flags = data->flags; | 1279 | server->flags = data->flags; |
1277 | server->caps |= NFS_CAP_ATOMIC_OPEN; | 1280 | server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR; |
1278 | server->options = data->options; | 1281 | server->options = data->options; |
1279 | 1282 | ||
1280 | /* Get a client record */ | 1283 | /* Get a client record */ |
@@ -1400,7 +1403,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, | |||
1400 | 1403 | ||
1401 | /* Initialise the client representation from the parent server */ | 1404 | /* Initialise the client representation from the parent server */ |
1402 | nfs_server_copy_userdata(server, parent_server); | 1405 | nfs_server_copy_userdata(server, parent_server); |
1403 | server->caps |= NFS_CAP_ATOMIC_OPEN; | 1406 | server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR; |
1404 | 1407 | ||
1405 | /* Get a client representation. | 1408 | /* Get a client representation. |
1406 | * Note: NFSv4 always uses TCP, */ | 1409 | * Note: NFSv4 always uses TCP, */ |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bd7938eda6a8..fe5a8b45d867 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -286,6 +286,11 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
286 | /* We can't support update_atime(), since the server will reset it */ | 286 | /* We can't support update_atime(), since the server will reset it */ |
287 | inode->i_flags |= S_NOATIME|S_NOCMTIME; | 287 | inode->i_flags |= S_NOATIME|S_NOCMTIME; |
288 | inode->i_mode = fattr->mode; | 288 | inode->i_mode = fattr->mode; |
289 | if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0 | ||
290 | && nfs_server_capable(inode, NFS_CAP_MODE)) | ||
291 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
292 | | NFS_INO_INVALID_ACCESS | ||
293 | | NFS_INO_INVALID_ACL; | ||
289 | /* Why so? Because we want revalidate for devices/FIFOs, and | 294 | /* Why so? Because we want revalidate for devices/FIFOs, and |
290 | * that's precisely what we have in nfs_file_inode_operations. | 295 | * that's precisely what we have in nfs_file_inode_operations. |
291 | */ | 296 | */ |
@@ -330,20 +335,46 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
330 | nfsi->attr_gencount = fattr->gencount; | 335 | nfsi->attr_gencount = fattr->gencount; |
331 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) | 336 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) |
332 | inode->i_atime = fattr->atime; | 337 | inode->i_atime = fattr->atime; |
338 | else if (nfs_server_capable(inode, NFS_CAP_ATIME)) | ||
339 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | ||
333 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) | 340 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) |
334 | inode->i_mtime = fattr->mtime; | 341 | inode->i_mtime = fattr->mtime; |
342 | else if (nfs_server_capable(inode, NFS_CAP_MTIME)) | ||
343 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
344 | | NFS_INO_INVALID_DATA; | ||
335 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) | 345 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) |
336 | inode->i_ctime = fattr->ctime; | 346 | inode->i_ctime = fattr->ctime; |
347 | else if (nfs_server_capable(inode, NFS_CAP_CTIME)) | ||
348 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
349 | | NFS_INO_INVALID_ACCESS | ||
350 | | NFS_INO_INVALID_ACL; | ||
337 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) | 351 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) |
338 | nfsi->change_attr = fattr->change_attr; | 352 | nfsi->change_attr = fattr->change_attr; |
353 | else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR)) | ||
354 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
355 | | NFS_INO_INVALID_DATA; | ||
339 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) | 356 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) |
340 | inode->i_size = nfs_size_to_loff_t(fattr->size); | 357 | inode->i_size = nfs_size_to_loff_t(fattr->size); |
358 | else | ||
359 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
360 | | NFS_INO_INVALID_DATA | ||
361 | | NFS_INO_REVAL_PAGECACHE; | ||
341 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) | 362 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) |
342 | inode->i_nlink = fattr->nlink; | 363 | inode->i_nlink = fattr->nlink; |
364 | else if (nfs_server_capable(inode, NFS_CAP_NLINK)) | ||
365 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | ||
343 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) | 366 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) |
344 | inode->i_uid = fattr->uid; | 367 | inode->i_uid = fattr->uid; |
368 | else if (nfs_server_capable(inode, NFS_CAP_OWNER)) | ||
369 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
370 | | NFS_INO_INVALID_ACCESS | ||
371 | | NFS_INO_INVALID_ACL; | ||
345 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) | 372 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) |
346 | inode->i_gid = fattr->gid; | 373 | inode->i_gid = fattr->gid; |
374 | else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP)) | ||
375 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
376 | | NFS_INO_INVALID_ACCESS | ||
377 | | NFS_INO_INVALID_ACL; | ||
347 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) | 378 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
348 | inode->i_blocks = fattr->du.nfs2.blocks; | 379 | inode->i_blocks = fattr->du.nfs2.blocks; |
349 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { | 380 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { |
@@ -1145,6 +1176,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1145 | loff_t cur_isize, new_isize; | 1176 | loff_t cur_isize, new_isize; |
1146 | unsigned long invalid = 0; | 1177 | unsigned long invalid = 0; |
1147 | unsigned long now = jiffies; | 1178 | unsigned long now = jiffies; |
1179 | unsigned long save_cache_validity; | ||
1148 | 1180 | ||
1149 | dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", | 1181 | dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", |
1150 | __func__, inode->i_sb->s_id, inode->i_ino, | 1182 | __func__, inode->i_sb->s_id, inode->i_ino, |
@@ -1171,10 +1203,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1171 | */ | 1203 | */ |
1172 | nfsi->read_cache_jiffies = fattr->time_start; | 1204 | nfsi->read_cache_jiffies = fattr->time_start; |
1173 | 1205 | ||
1174 | if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) || (fattr->valid & (NFS_ATTR_FATTR_MTIME|NFS_ATTR_FATTR_CTIME))) | 1206 | save_cache_validity = nfsi->cache_validity; |
1175 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR | 1207 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR |
1176 | | NFS_INO_INVALID_ATIME | 1208 | | NFS_INO_INVALID_ATIME |
1177 | | NFS_INO_REVAL_PAGECACHE); | 1209 | | NFS_INO_REVAL_FORCED |
1210 | | NFS_INO_REVAL_PAGECACHE); | ||
1178 | 1211 | ||
1179 | /* Do atomic weak cache consistency updates */ | 1212 | /* Do atomic weak cache consistency updates */ |
1180 | nfs_wcc_update_inode(inode, fattr); | 1213 | nfs_wcc_update_inode(inode, fattr); |
@@ -1189,7 +1222,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1189 | nfs_force_lookup_revalidate(inode); | 1222 | nfs_force_lookup_revalidate(inode); |
1190 | nfsi->change_attr = fattr->change_attr; | 1223 | nfsi->change_attr = fattr->change_attr; |
1191 | } | 1224 | } |
1192 | } | 1225 | } else if (server->caps & NFS_CAP_CHANGE_ATTR) |
1226 | invalid |= save_cache_validity; | ||
1193 | 1227 | ||
1194 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) { | 1228 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) { |
1195 | /* NFSv2/v3: Check if the mtime agrees */ | 1229 | /* NFSv2/v3: Check if the mtime agrees */ |
@@ -1201,7 +1235,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1201 | nfs_force_lookup_revalidate(inode); | 1235 | nfs_force_lookup_revalidate(inode); |
1202 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | 1236 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
1203 | } | 1237 | } |
1204 | } | 1238 | } else if (server->caps & NFS_CAP_MTIME) |
1239 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1240 | | NFS_INO_INVALID_DATA | ||
1241 | | NFS_INO_REVAL_PAGECACHE | ||
1242 | | NFS_INO_REVAL_FORCED); | ||
1243 | |||
1205 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) { | 1244 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) { |
1206 | /* If ctime has changed we should definitely clear access+acl caches */ | 1245 | /* If ctime has changed we should definitely clear access+acl caches */ |
1207 | if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) { | 1246 | if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) { |
@@ -1215,7 +1254,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1215 | } | 1254 | } |
1216 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); | 1255 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); |
1217 | } | 1256 | } |
1218 | } | 1257 | } else if (server->caps & NFS_CAP_CTIME) |
1258 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1259 | | NFS_INO_INVALID_ACCESS | ||
1260 | | NFS_INO_INVALID_ACL | ||
1261 | | NFS_INO_REVAL_FORCED); | ||
1219 | 1262 | ||
1220 | /* Check if our cached file size is stale */ | 1263 | /* Check if our cached file size is stale */ |
1221 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) { | 1264 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) { |
@@ -1231,30 +1274,50 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1231 | dprintk("NFS: isize change on server for file %s/%ld\n", | 1274 | dprintk("NFS: isize change on server for file %s/%ld\n", |
1232 | inode->i_sb->s_id, inode->i_ino); | 1275 | inode->i_sb->s_id, inode->i_ino); |
1233 | } | 1276 | } |
1234 | } | 1277 | } else |
1278 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1279 | | NFS_INO_REVAL_PAGECACHE | ||
1280 | | NFS_INO_REVAL_FORCED); | ||
1235 | 1281 | ||
1236 | 1282 | ||
1237 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) | 1283 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) |
1238 | memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); | 1284 | memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); |
1285 | else if (server->caps & NFS_CAP_ATIME) | ||
1286 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATIME | ||
1287 | | NFS_INO_REVAL_FORCED); | ||
1239 | 1288 | ||
1240 | if (fattr->valid & NFS_ATTR_FATTR_MODE) { | 1289 | if (fattr->valid & NFS_ATTR_FATTR_MODE) { |
1241 | if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)) { | 1290 | if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)) { |
1242 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 1291 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; |
1243 | inode->i_mode = fattr->mode; | 1292 | inode->i_mode = fattr->mode; |
1244 | } | 1293 | } |
1245 | } | 1294 | } else if (server->caps & NFS_CAP_MODE) |
1295 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1296 | | NFS_INO_INVALID_ACCESS | ||
1297 | | NFS_INO_INVALID_ACL | ||
1298 | | NFS_INO_REVAL_FORCED); | ||
1299 | |||
1246 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) { | 1300 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) { |
1247 | if (inode->i_uid != fattr->uid) { | 1301 | if (inode->i_uid != fattr->uid) { |
1248 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 1302 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; |
1249 | inode->i_uid = fattr->uid; | 1303 | inode->i_uid = fattr->uid; |
1250 | } | 1304 | } |
1251 | } | 1305 | } else if (server->caps & NFS_CAP_OWNER) |
1306 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1307 | | NFS_INO_INVALID_ACCESS | ||
1308 | | NFS_INO_INVALID_ACL | ||
1309 | | NFS_INO_REVAL_FORCED); | ||
1310 | |||
1252 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) { | 1311 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) { |
1253 | if (inode->i_gid != fattr->gid) { | 1312 | if (inode->i_gid != fattr->gid) { |
1254 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 1313 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; |
1255 | inode->i_gid = fattr->gid; | 1314 | inode->i_gid = fattr->gid; |
1256 | } | 1315 | } |
1257 | } | 1316 | } else if (server->caps & NFS_CAP_OWNER_GROUP) |
1317 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1318 | | NFS_INO_INVALID_ACCESS | ||
1319 | | NFS_INO_INVALID_ACL | ||
1320 | | NFS_INO_REVAL_FORCED); | ||
1258 | 1321 | ||
1259 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) { | 1322 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) { |
1260 | if (inode->i_nlink != fattr->nlink) { | 1323 | if (inode->i_nlink != fattr->nlink) { |
@@ -1263,7 +1326,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1263 | invalid |= NFS_INO_INVALID_DATA; | 1326 | invalid |= NFS_INO_INVALID_DATA; |
1264 | inode->i_nlink = fattr->nlink; | 1327 | inode->i_nlink = fattr->nlink; |
1265 | } | 1328 | } |
1266 | } | 1329 | } else if (server->caps & NFS_CAP_NLINK) |
1330 | invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR | ||
1331 | | NFS_INO_REVAL_FORCED); | ||
1267 | 1332 | ||
1268 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { | 1333 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { |
1269 | /* | 1334 | /* |
@@ -1293,9 +1358,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1293 | || S_ISLNK(inode->i_mode))) | 1358 | || S_ISLNK(inode->i_mode))) |
1294 | invalid &= ~NFS_INO_INVALID_DATA; | 1359 | invalid &= ~NFS_INO_INVALID_DATA; |
1295 | if (!nfs_have_delegation(inode, FMODE_READ) || | 1360 | if (!nfs_have_delegation(inode, FMODE_READ) || |
1296 | (nfsi->cache_validity & NFS_INO_REVAL_FORCED)) | 1361 | (save_cache_validity & NFS_INO_REVAL_FORCED)) |
1297 | nfsi->cache_validity |= invalid; | 1362 | nfsi->cache_validity |= invalid; |
1298 | nfsi->cache_validity &= ~NFS_INO_REVAL_FORCED; | ||
1299 | 1363 | ||
1300 | return 0; | 1364 | return 0; |
1301 | out_changed: | 1365 | out_changed: |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d95f7f9e60c4..be6544aef41f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2003,12 +2003,34 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f | |||
2003 | status = nfs4_call_sync(server, &msg, &args, &res, 0); | 2003 | status = nfs4_call_sync(server, &msg, &args, &res, 0); |
2004 | if (status == 0) { | 2004 | if (status == 0) { |
2005 | memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); | 2005 | memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); |
2006 | server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| | ||
2007 | NFS_CAP_SYMLINKS|NFS_CAP_FILEID| | ||
2008 | NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER| | ||
2009 | NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME| | ||
2010 | NFS_CAP_CTIME|NFS_CAP_MTIME); | ||
2006 | if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) | 2011 | if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) |
2007 | server->caps |= NFS_CAP_ACLS; | 2012 | server->caps |= NFS_CAP_ACLS; |
2008 | if (res.has_links != 0) | 2013 | if (res.has_links != 0) |
2009 | server->caps |= NFS_CAP_HARDLINKS; | 2014 | server->caps |= NFS_CAP_HARDLINKS; |
2010 | if (res.has_symlinks != 0) | 2015 | if (res.has_symlinks != 0) |
2011 | server->caps |= NFS_CAP_SYMLINKS; | 2016 | server->caps |= NFS_CAP_SYMLINKS; |
2017 | if (res.attr_bitmask[0] & FATTR4_WORD0_FILEID) | ||
2018 | server->caps |= NFS_CAP_FILEID; | ||
2019 | if (res.attr_bitmask[1] & FATTR4_WORD1_MODE) | ||
2020 | server->caps |= NFS_CAP_MODE; | ||
2021 | if (res.attr_bitmask[1] & FATTR4_WORD1_NUMLINKS) | ||
2022 | server->caps |= NFS_CAP_NLINK; | ||
2023 | if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER) | ||
2024 | server->caps |= NFS_CAP_OWNER; | ||
2025 | if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER_GROUP) | ||
2026 | server->caps |= NFS_CAP_OWNER_GROUP; | ||
2027 | if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_ACCESS) | ||
2028 | server->caps |= NFS_CAP_ATIME; | ||
2029 | if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_METADATA) | ||
2030 | server->caps |= NFS_CAP_CTIME; | ||
2031 | if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY) | ||
2032 | server->caps |= NFS_CAP_MTIME; | ||
2033 | |||
2012 | memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); | 2034 | memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); |
2013 | server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; | 2035 | server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; |
2014 | server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; | 2036 | server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 19fe15d12042..320569eabe3b 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -167,6 +167,15 @@ struct nfs_server { | |||
167 | #define NFS_CAP_SYMLINKS (1U << 2) | 167 | #define NFS_CAP_SYMLINKS (1U << 2) |
168 | #define NFS_CAP_ACLS (1U << 3) | 168 | #define NFS_CAP_ACLS (1U << 3) |
169 | #define NFS_CAP_ATOMIC_OPEN (1U << 4) | 169 | #define NFS_CAP_ATOMIC_OPEN (1U << 4) |
170 | #define NFS_CAP_CHANGE_ATTR (1U << 5) | ||
171 | #define NFS_CAP_FILEID (1U << 6) | ||
172 | #define NFS_CAP_MODE (1U << 7) | ||
173 | #define NFS_CAP_NLINK (1U << 8) | ||
174 | #define NFS_CAP_OWNER (1U << 9) | ||
175 | #define NFS_CAP_OWNER_GROUP (1U << 10) | ||
176 | #define NFS_CAP_ATIME (1U << 11) | ||
177 | #define NFS_CAP_CTIME (1U << 12) | ||
178 | #define NFS_CAP_MTIME (1U << 13) | ||
170 | 179 | ||
171 | 180 | ||
172 | /* maximum number of slots to use */ | 181 | /* maximum number of slots to use */ |