For creating fattrs with the label field already allocated for us. I also update nfs_free_fattr() to free the label in the end.
Showing the changes to include (1 of 4 files). Show all
Unified · Split
| @@ -426,9 +426,22 @@ extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr); · 425 unmodified lines | ||
| 426 | 426 | extern unsigned long nfs_inc_attr_generation_counter(void); |
| 427 | 427 | |
| 428 | 428 | extern struct nfs_fattr *nfs_alloc_fattr(void); |
| 429 | +extern struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server); | |
| 430 | + | |
| 431 | +static inline void nfs4_label_free(struct nfs4_label *label) | |
| 432 | +{ | |
| 433 | +#ifdef CONFIG_NFS_V4_SECURITY_LABEL | |
| 434 | + if (label) { | |
| 435 | + kfree(label->label); | |
| 436 | + kfree(label); | |
| 437 | + } | |
| 438 | +#endif | |
| 439 | +} | |
| 429 | 440 | |
| 430 | 441 | static inline void nfs_free_fattr(const struct nfs_fattr *fattr) |
| 431 | 442 | { |
| 443 | + if (fattr) | |
| 444 | + nfs4_label_free(fattr->label); | |
| 432 | 445 | kfree(fattr); |
| 433 | 446 | } |
| 434 | 447 | |