550-ubifs-symlink-xattr-support.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --- a/fs/ubifs/file.c
  2. +++ b/fs/ubifs/file.c
  3. @@ -1597,6 +1597,10 @@ const struct inode_operations ubifs_syml
  4. .follow_link = ubifs_follow_link,
  5. .setattr = ubifs_setattr,
  6. .getattr = ubifs_getattr,
  7. + .setxattr = ubifs_setxattr,
  8. + .getxattr = ubifs_getxattr,
  9. + .listxattr = ubifs_listxattr,
  10. + .removexattr = ubifs_removexattr,
  11. };
  12. const struct file_operations ubifs_file_operations = {
  13. --- a/fs/ubifs/journal.c
  14. +++ b/fs/ubifs/journal.c
  15. @@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info *
  16. aligned_dlen = ALIGN(dlen, 8);
  17. aligned_ilen = ALIGN(ilen, 8);
  18. len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
  19. + if (xent) {
  20. + /*
  21. + * Make sure to account for host_ui->data_len in
  22. + * length calculation in case there is extended attribute.
  23. + */
  24. + len += host_ui->data_len;
  25. + }
  26. dent = kmalloc(len, GFP_NOFS);
  27. if (!dent)
  28. return -ENOMEM;
  29. @@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info *
  30. ino_key_init(c, &ino_key, dir->i_ino);
  31. ino_offs += aligned_ilen;
  32. - err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
  33. + err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
  34. + UBIFS_INO_NODE_SZ + host_ui->data_len);
  35. if (err)
  36. goto out_ro;
  37. --- a/fs/ubifs/xattr.c
  38. +++ b/fs/ubifs/xattr.c
  39. @@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
  40. goto out_free;
  41. }
  42. inode->i_size = ui->ui_size = size;
  43. - ui->data_len = size;
  44. mutex_lock(&host_ui->ui_mutex);
  45. host->i_ctime = ubifs_current_time(host);
  46. host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
  47. host_ui->xattr_size += CALC_XATTR_BYTES(size);
  48. + ui->data_len = size;
  49. /*
  50. * It is important to write the host inode after the xattr inode