Advertisement
Guest User

Data races in ext4 - ext4_do_update_inode

a guest
Apr 8th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 26.17 KB | None | 0 0
  1. ====================================================================================================================================================================================
  2. Variable: inode->i_ctime    Addresses: c110aac1 c10b79ec
  3. c110aac1 ext4_encode_extra_time /linux-3.13.5/fs/ext4/ext4.h:729
  4. c10b79ec update_time /linux-3.13.5/fs/inode.c:1510
  5.  
  6. c10b79ec <-> c110aac1
  7. c10b79ec <-> c110aac1
  8.  
  9. /linux-3.13.5/fs/ext4/ext4.h:729
  10.        719   * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
  11.        720   */
  12.        721  #define EXT4_FITS_IN_INODE(ext4_inode, einode, field)   \
  13.        722      ((offsetof(typeof(*ext4_inode), field) +    \
  14.        723        sizeof((ext4_inode)->field))          \
  15.        724      <= (EXT4_GOOD_OLD_INODE_SIZE +          \
  16.        725          (einode)->i_extra_isize))           \
  17.        726
  18.        727  static inline __le32 ext4_encode_extra_time(struct timespec *time)
  19.        728  {
  20. ==>    729         return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
  21.        730                 (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) |
  22.        731                            ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK));
  23.        732  }
  24.        733
  25.        734  static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
  26.        735  {
  27.        736         if (sizeof(time->tv_sec) > 4)
  28.        737             time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
  29.        738                     << 32;
  30.        739         time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
  31.  
  32. /linux-3.13.5/fs/inode.c:1510
  33.       1500  static int update_time(struct inode *inode, struct timespec *time, int flags)
  34.       1501  {
  35.       1502      if (inode->i_op->update_time)
  36.       1503          return inode->i_op->update_time(inode, time, flags);
  37.       1504
  38.       1505      if (flags & S_ATIME)
  39.       1506          inode->i_atime = *time;
  40.       1507      if (flags & S_VERSION)
  41.       1508          inode_inc_iversion(inode);
  42.       1509      if (flags & S_CTIME)
  43. ==>   1510          inode->i_ctime = *time;
  44.       1511      if (flags & S_MTIME)
  45.       1512          inode->i_mtime = *time;
  46.       1513      mark_inode_dirty_sync(inode);
  47.       1514      return 0;
  48.       1515  }
  49.       1516
  50.       1517  /**
  51.       1518   *  touch_atime -   update the access time
  52.       1519   *  @path: the &struct path to update
  53.       1520   *
  54.  
  55.  
  56. ====================================================================================================================================================================================
  57. Variable: i_crtime  Addresses: c110ab4a
  58. c110ab4a ext4_encode_extra_time /linux-3.13.5/fs/ext4/ext4.h:729
  59.  
  60. c110ab4a <-> c110ab4a
  61.  
  62. /linux-3.13.5/fs/ext4/ext4.h:729
  63.        719   * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
  64.        720   */
  65.        721  #define EXT4_FITS_IN_INODE(ext4_inode, einode, field)   \
  66.        722      ((offsetof(typeof(*ext4_inode), field) +    \
  67.        723        sizeof((ext4_inode)->field))          \
  68.        724      <= (EXT4_GOOD_OLD_INODE_SIZE +          \
  69.        725          (einode)->i_extra_isize))           \
  70.        726
  71.        727  static inline __le32 ext4_encode_extra_time(struct timespec *time)
  72.        728  {
  73. ==>    729         return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
  74.        730                 (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) |
  75.        731                            ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK));
  76.        732  }
  77.        733
  78.        734  static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
  79.        735  {
  80.        736         if (sizeof(time->tv_sec) > 4)
  81.        737             time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
  82.        738                     << 32;
  83.        739         time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
  84.  
  85.  
  86. ====================================================================================================================================================================================
  87. Variable: ei->i_disksize    Addresses: c110c813 c110ac06
  88. c110c813 ext4_wb_update_i_disksize /linux-3.13.5/fs/ext4/ext4.h:2476
  89. c110ac06 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4342
  90.  
  91. c110c813 <-> c110ac06
  92. c110c813 <-> c110ac06
  93.  
  94. /linux-3.13.5/fs/ext4/ext4.h:2476
  95.       2466   */
  96.       2467  static inline void ext4_wb_update_i_disksize(struct inode *inode, loff_t newsize)
  97.       2468  {
  98.       2469      loff_t i_size;
  99.       2470 
  100.       2471      down_write(&EXT4_I(inode)->i_data_sem);
  101.       2472      i_size = i_size_read(inode);
  102.       2473      if (newsize > i_size)
  103.       2474          newsize = i_size;
  104.       2475      if (newsize > EXT4_I(inode)->i_disksize)
  105. ==>   2476          EXT4_I(inode)->i_disksize = newsize;      
  106.       2477      up_write(&EXT4_I(inode)->i_data_sem);
  107.       2478  }
  108.       2479 
  109.       2480  struct ext4_group_info {
  110.       2481      unsigned long   bb_state;
  111.       2482      struct rb_root  bb_free_root;
  112.       2483      ext4_grpblk_t   bb_first_free;  /* first free block */
  113.       2484      ext4_grpblk_t   bb_free;    /* total free blocks */
  114.       2485      ext4_grpblk_t   bb_fragments;   /* nr of freespace fragments */
  115.       2486      ext4_grpblk_t   bb_largest_free_order;/* order of largest frag in BG */
  116.  
  117. /linux-3.13.5/fs/ext4/inode.c:4342
  118.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  119.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  120.       4334          cpu_to_le32(EXT4_OS_HURD))
  121.       4335          raw_inode->i_file_acl_high =
  122.       4336              cpu_to_le16(ei->i_file_acl >> 32);
  123.       4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
  124.       4338      if (ei->i_disksize != ext4_isize(raw_inode)) {
  125.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  126.       4340          need_datasync = 1;
  127.       4341      }
  128. ==>   4342      if (ei->i_disksize > 0x7fffffffULL) {      
  129.       4343          struct super_block *sb = inode->i_sb;
  130.       4344          if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
  131.       4345                  EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
  132.       4346                  EXT4_SB(sb)->s_es->s_rev_level ==
  133.       4347                  cpu_to_le32(EXT4_GOOD_OLD_REV)) {
  134.       4348              /* If this is the first large file
  135.       4349               * created, add a flag to the superblock.
  136.       4350               */
  137.       4351              err = ext4_journal_get_write_access(handle,
  138.       4352                      EXT4_SB(sb)->s_sbh);
  139.  
  140.  
  141. ====================================================================================================================================================================================
  142. Variable: raw_inode->i_gid_high Addresses: c110aa6a
  143. c110aa6a ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4311
  144.  
  145. c110aa6a <-> c110aa6a
  146.  
  147. /linux-3.13.5/fs/ext4/inode.c:4311
  148.       4301          raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));
  149.       4302          raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
  150.       4303  /*
  151.       4304   * Fix up interoperability with old kernels. Otherwise, old inodes get
  152.       4305   * re-used with the upper 16 bits of the uid/gid intact
  153.       4306   */
  154.       4307          if (!ei->i_dtime) {
  155.       4308              raw_inode->i_uid_high =
  156.       4309                  cpu_to_le16(high_16_bits(i_uid));
  157.       4310              raw_inode->i_gid_high =
  158. ==>   4311                  cpu_to_le16(high_16_bits(i_gid));      
  159.       4312          } else {
  160.       4313              raw_inode->i_uid_high = 0;
  161.       4314              raw_inode->i_gid_high = 0;
  162.       4315          }
  163.       4316      } else {
  164.       4317          raw_inode->i_uid_low = cpu_to_le16(fs_high2lowuid(i_uid));
  165.       4318          raw_inode->i_gid_low = cpu_to_le16(fs_high2lowgid(i_gid));
  166.       4319          raw_inode->i_uid_high = 0;
  167.       4320          raw_inode->i_gid_high = 0;
  168.       4321      }
  169.  
  170.  
  171. ====================================================================================================================================================================================
  172. Variable: raw_inode->i_dtime    Addresses: c110adf2
  173. c110adf2 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4331
  174.  
  175. c110adf2 <-> c110adf2
  176.  
  177. /linux-3.13.5/fs/ext4/inode.c:4331
  178.       4321      }
  179.       4322      raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
  180.       4323 
  181.       4324      EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
  182.       4325      EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
  183.       4326      EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
  184.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  185.       4328 
  186.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  187.       4330          goto out_brelse;
  188. ==>   4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);      
  189.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  190.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  191.       4334          cpu_to_le32(EXT4_OS_HURD))
  192.       4335          raw_inode->i_file_acl_high =
  193.       4336              cpu_to_le16(ei->i_file_acl >> 32);
  194.       4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
  195.       4338      if (ei->i_disksize != ext4_isize(raw_inode)) {
  196.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  197.       4340          need_datasync = 1;
  198.       4341      }
  199.  
  200.  
  201. ====================================================================================================================================================================================
  202. Variable: i_mtime   Addresses: c110aac7
  203. c110aac7 ext4_encode_extra_time /linux-3.13.5/fs/ext4/ext4.h:729
  204.  
  205. c110aac7 <-> c110aac7
  206.  
  207. /linux-3.13.5/fs/ext4/ext4.h:729
  208.        719   * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
  209.        720   */
  210.        721  #define EXT4_FITS_IN_INODE(ext4_inode, einode, field)   \
  211.        722      ((offsetof(typeof(*ext4_inode), field) +    \
  212.        723        sizeof((ext4_inode)->field))          \
  213.        724      <= (EXT4_GOOD_OLD_INODE_SIZE +          \
  214.        725          (einode)->i_extra_isize))           \
  215.        726 
  216.        727  static inline __le32 ext4_encode_extra_time(struct timespec *time)
  217.        728  {
  218. ==>    729         return cpu_to_le32((sizeof(time->tv_sec) > 4 ?      
  219.        730                 (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) |
  220.        731                            ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK));
  221.        732  }
  222.        733 
  223.        734  static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
  224.        735  {
  225.        736         if (sizeof(time->tv_sec) > 4)
  226.        737             time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
  227.        738                     << 32;
  228.        739         time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
  229.  
  230.  
  231. ====================================================================================================================================================================================
  232. Variable: i_mtime   Addresses: c110aad0
  233. c110aad0 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4325
  234.  
  235. c110aad0 <-> c110aad0
  236.  
  237. /linux-3.13.5/fs/ext4/inode.c:4325
  238.       4315          }
  239.       4316      } else {
  240.       4317          raw_inode->i_uid_low = cpu_to_le16(fs_high2lowuid(i_uid));
  241.       4318          raw_inode->i_gid_low = cpu_to_le16(fs_high2lowgid(i_gid));
  242.       4319          raw_inode->i_uid_high = 0;
  243.       4320          raw_inode->i_gid_high = 0;
  244.       4321      }
  245.       4322      raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
  246.       4323 
  247.       4324      EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
  248. ==>   4325      EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);      
  249.       4326      EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
  250.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  251.       4328 
  252.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  253.       4330          goto out_brelse;
  254.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  255.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  256.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  257.       4334          cpu_to_le32(EXT4_OS_HURD))
  258.       4335          raw_inode->i_file_acl_high =
  259.  
  260. ====================================================================================================================================================================================
  261. Variable: raw_inode->i_file_acl_high    Addresses: c110abbf
  262. c110abbf ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4336
  263.  
  264. c110abbf <-> c110abbf
  265.  
  266. /linux-3.13.5/fs/ext4/inode.c:4336
  267.       4326      EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
  268.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  269.       4328 
  270.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  271.       4330          goto out_brelse;
  272.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  273.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  274.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  275.       4334          cpu_to_le32(EXT4_OS_HURD))
  276.       4335          raw_inode->i_file_acl_high =
  277. ==>   4336              cpu_to_le16(ei->i_file_acl >> 32);      
  278.       4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
  279.       4338      if (ei->i_disksize != ext4_isize(raw_inode)) {
  280.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  281.       4340          need_datasync = 1;
  282.       4341      }
  283.       4342      if (ei->i_disksize > 0x7fffffffULL) {
  284.       4343          struct super_block *sb = inode->i_sb;
  285.       4344          if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
  286.       4345                  EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
  287.       4346                  EXT4_SB(sb)->s_es->s_rev_level ==
  288.  
  289.  
  290. ====================================================================================================================================================================================
  291. Variable: iraw_inode->i_flags   Addresses: c110adf8
  292. c110adf8 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4332
  293.  
  294. c110adf8 <-> c110adf8
  295.  
  296. /linux-3.13.5/fs/ext4/inode.c:4332
  297.       4322      raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
  298.       4323 
  299.       4324      EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
  300.       4325      EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
  301.       4326      EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
  302.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  303.       4328 
  304.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  305.       4330          goto out_brelse;
  306.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  307. ==>   4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);      
  308.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  309.       4334          cpu_to_le32(EXT4_OS_HURD))
  310.       4335          raw_inode->i_file_acl_high =
  311.       4336              cpu_to_le16(ei->i_file_acl >> 32);
  312.       4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
  313.       4338      if (ei->i_disksize != ext4_isize(raw_inode)) {
  314.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  315.       4340          need_datasync = 1;
  316.       4341      }
  317.       4342      if (ei->i_disksize > 0x7fffffffULL) {
  318.  
  319.  
  320. ====================================================================================================================================================================================
  321. Variable: raw_inode->i_file_acl_lo  Addresses: c110abc6
  322. c110abc6 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4337
  323.  
  324. c110abc6 <-> c110abc6
  325.  
  326. /linux-3.13.5/fs/ext4/inode.c:4337
  327.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  328.       4328 
  329.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  330.       4330          goto out_brelse;
  331.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  332.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  333.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  334.       4334          cpu_to_le32(EXT4_OS_HURD))
  335.       4335          raw_inode->i_file_acl_high =
  336.       4336              cpu_to_le16(ei->i_file_acl >> 32);
  337. ==>   4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);      
  338.       4338      if (ei->i_disksize != ext4_isize(raw_inode)) {
  339.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  340.       4340          need_datasync = 1;
  341.       4341      }
  342.       4342      if (ei->i_disksize > 0x7fffffffULL) {
  343.       4343          struct super_block *sb = inode->i_sb;
  344.       4344          if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
  345.       4345                  EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
  346.       4346                  EXT4_SB(sb)->s_es->s_rev_level ==
  347.       4347                  cpu_to_le32(EXT4_GOOD_OLD_REV)) {
  348.  
  349.  
  350. ====================================================================================================================================================================================
  351. Variable: raw_inode->i_blocks_lo    Addresses: c110ab5e
  352. c110ab5e ext4_inode_blocks_set /linux-3.13.5/fs/ext4/inode.c:4246
  353.  
  354. c110ab5e <-> c110ab5e
  355.  
  356. /linux-3.13.5/fs/ext4/inode.c:4246
  357.       4236  {
  358.       4237      struct inode *inode = &(ei->vfs_inode);
  359.       4238      u64 i_blocks = inode->i_blocks;
  360.       4239      struct super_block *sb = inode->i_sb;
  361.       4240 
  362.       4241      if (i_blocks <= ~0U) {
  363.       4242          /*
  364.       4243           * i_blocks can be represented in a 32 bit variable
  365.       4244           * as multiple of 512 bytes
  366.       4245           */
  367. ==>   4246          raw_inode->i_blocks_lo   = cpu_to_le32(i_blocks);      
  368.       4247          raw_inode->i_blocks_high = 0;
  369.       4248          ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE);
  370.       4249          return 0;
  371.       4250      }
  372.       4251      if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE))
  373.       4252          return -EFBIG;
  374.       4253 
  375.       4254      if (i_blocks <= 0xffffffffffffULL) {
  376.       4255          /*
  377.       4256           * i_blocks can be represented in a 48 bit variable
  378.  
  379. ====================================================================================================================================================================================
  380. Variable: raw_inode->i_links_count  Addresses: c110aaa6
  381. c110aaa6 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4322
  382.  
  383. c110aaa6 <-> c110aaa6
  384.  
  385. /linux-3.13.5/fs/ext4/inode.c:4322
  386.       4312          } else {
  387.       4313              raw_inode->i_uid_high = 0;
  388.       4314              raw_inode->i_gid_high = 0;
  389.       4315          }
  390.       4316      } else {
  391.       4317          raw_inode->i_uid_low = cpu_to_le16(fs_high2lowuid(i_uid));
  392.       4318          raw_inode->i_gid_low = cpu_to_le16(fs_high2lowgid(i_gid));
  393.       4319          raw_inode->i_uid_high = 0;
  394.       4320          raw_inode->i_gid_high = 0;
  395.       4321      }
  396. ==>   4322      raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);      
  397.       4323 
  398.       4324      EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
  399.       4325      EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
  400.       4326      EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
  401.       4327      EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
  402.       4328 
  403.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  404.       4330          goto out_brelse;
  405.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  406.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  407.  
  408.  
  409. ====================================================================================================================================================================================
  410. Variable: raw_inode->i_mode     Addresses: c110aa52 c110aa3a c110abc9
  411. c110aa3a ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4297
  412. c110aa52 ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4301
  413. c110abc9 ext4_isize /linux-3.13.5/fs/ext4/ext4.h:2386
  414.  
  415. c110aa3a <-> c110abc9
  416. c110aa52 <-> c110abc9
  417. c110aa52 <-> c110abc9
  418.  
  419. /linux-3.13.5/fs/ext4/inode.c:4297
  420.       4287      int need_datasync = 0;
  421.       4288      uid_t i_uid;
  422.       4289      gid_t i_gid;
  423.       4290 
  424.       4291      /* For fields not not tracking in the in-memory inode,
  425.       4292       * initialise them to zero for new inodes. */
  426.       4293      if (ext4_test_inode_state(inode, EXT4_STATE_NEW))
  427.       4294          memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
  428.       4295 
  429.       4296      ext4_get_inode_flags(ei);
  430. ==>   4297      raw_inode->i_mode = cpu_to_le16(inode->i_mode);      
  431.       4298      i_uid = i_uid_read(inode);
  432.       4299      i_gid = i_gid_read(inode);
  433.       4300      if (!(test_opt(inode->i_sb, NO_UID32))) {
  434.       4301          raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));
  435.       4302          raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
  436.       4303  /*
  437.       4304   * Fix up interoperability with old kernels. Otherwise, old inodes get
  438.       4305   * re-used with the upper 16 bits of the uid/gid intact
  439.       4306   */
  440.       4307          if (!ei->i_dtime) {
  441.  
  442. /linux-3.13.5/fs/ext4/inode.c:4301
  443.       4291      /* For fields not not tracking in the in-memory inode,
  444.       4292       * initialise them to zero for new inodes. */
  445.       4293      if (ext4_test_inode_state(inode, EXT4_STATE_NEW))
  446.       4294          memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
  447.       4295 
  448.       4296      ext4_get_inode_flags(ei);
  449.       4297      raw_inode->i_mode = cpu_to_le16(inode->i_mode);
  450.       4298      i_uid = i_uid_read(inode);
  451.       4299      i_gid = i_gid_read(inode);
  452.       4300      if (!(test_opt(inode->i_sb, NO_UID32))) {
  453. ==>   4301          raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));      
  454.       4302          raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
  455.       4303  /*
  456.       4304   * Fix up interoperability with old kernels. Otherwise, old inodes get
  457.       4305   * re-used with the upper 16 bits of the uid/gid intact
  458.       4306   */
  459.       4307          if (!ei->i_dtime) {
  460.       4308              raw_inode->i_uid_high =
  461.       4309                  cpu_to_le16(high_16_bits(i_uid));
  462.       4310              raw_inode->i_gid_high =
  463.       4311                  cpu_to_le16(high_16_bits(i_gid));
  464.  
  465. /linux-3.13.5/fs/ext4/ext4.h:2386
  466.       2376 
  467.       2377  static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
  468.       2378                         ext4_fsblk_t blk)
  469.       2379  {
  470.       2380      es->s_r_blocks_count_lo = cpu_to_le32((u32)blk);
  471.       2381      es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
  472.       2382  }
  473.       2383 
  474.       2384  static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
  475.       2385  {
  476. ==>   2386      if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))      
  477.       2387          return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
  478.       2388              le32_to_cpu(raw_inode->i_size_lo);
  479.       2389      else
  480.       2390          return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
  481.       2391  }
  482.       2392 
  483.       2393  static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
  484.       2394  {
  485.       2395      raw_inode->i_size_lo = cpu_to_le32(i_size);
  486.       2396      raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
  487.  
  488.  
  489. ====================================================================================================================================================================================
  490. Variable: EXT4_I(inode)->i_disksize Addresses: c110c810 c110c147 c110abcb c110c7d2
  491. c110c810 ext4_wb_update_i_disksize /linux-3.13.5/fs/ext4/ext4.h:2476
  492. c110abcb ext4_do_update_inode /linux-3.13.5/fs/ext4/inode.c:4338
  493. c110c7d2 mpage_map_and_submit_extent /linux-3.13.5/fs/ext4/inode.c:2236
  494. c110c147 ext4_da_write_end /linux-3.13.5/fs/ext4/inode.c:2758
  495.  
  496. c110c810 <-> c110abcb
  497. c110c147 <-> c110abcb
  498. c110c147 <-> c110c7d2
  499. c110c147 <-> c110c7d2
  500.  
  501. /linux-3.13.5/fs/ext4/ext4.h:2476
  502.       2466   */
  503.       2467  static inline void ext4_wb_update_i_disksize(struct inode *inode, loff_t newsize)
  504.       2468  {
  505.       2469      loff_t i_size;
  506.       2470 
  507.       2471      down_write(&EXT4_I(inode)->i_data_sem);
  508.       2472      i_size = i_size_read(inode);
  509.       2473      if (newsize > i_size)
  510.       2474          newsize = i_size;
  511.       2475      if (newsize > EXT4_I(inode)->i_disksize)
  512. ==>   2476          EXT4_I(inode)->i_disksize = newsize;      
  513.       2477      up_write(&EXT4_I(inode)->i_data_sem);
  514.       2478  }
  515.       2479 
  516.       2480  struct ext4_group_info {
  517.       2481      unsigned long   bb_state;
  518.       2482      struct rb_root  bb_free_root;
  519.       2483      ext4_grpblk_t   bb_first_free;  /* first free block */
  520.       2484      ext4_grpblk_t   bb_free;    /* total free blocks */
  521.       2485      ext4_grpblk_t   bb_fragments;   /* nr of freespace fragments */
  522.       2486      ext4_grpblk_t   bb_largest_free_order;/* order of largest frag in BG */
  523.  
  524. /linux-3.13.5/fs/ext4/inode.c:4338
  525.       4328 
  526.       4329      if (ext4_inode_blocks_set(handle, raw_inode, ei))
  527.       4330          goto out_brelse;
  528.       4331      raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  529.       4332      raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
  530.       4333      if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
  531.       4334          cpu_to_le32(EXT4_OS_HURD))
  532.       4335          raw_inode->i_file_acl_high =
  533.       4336              cpu_to_le16(ei->i_file_acl >> 32);
  534.       4337      raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
  535. ==>   4338      if (ei->i_disksize != ext4_isize(raw_inode)) {      
  536.       4339          ext4_isize_set(raw_inode, ei->i_disksize);
  537.       4340          need_datasync = 1;
  538.       4341      }
  539.       4342      if (ei->i_disksize > 0x7fffffffULL) {
  540.       4343          struct super_block *sb = inode->i_sb;
  541.       4344          if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
  542.       4345                  EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
  543.       4346                  EXT4_SB(sb)->s_es->s_rev_level ==
  544.       4347                  cpu_to_le32(EXT4_GOOD_OLD_REV)) {
  545.       4348              /* If this is the first large file
  546.  
  547. /linux-3.13.5/fs/ext4/inode.c:2236
  548.       2226           * Update buffer state, submit mapped pages, and get us new
  549.       2227           * extent to map
  550.       2228           */
  551.       2229          err = mpage_map_and_submit_buffers(mpd);
  552.       2230          if (err < 0)
  553.       2231              return err;
  554.       2232      } while (map->m_len);
  555.       2233 
  556.       2234      /* Update on-disk size after IO is submitted */
  557.       2235      disksize = ((loff_t)mpd->first_page) << PAGE_CACHE_SHIFT;
  558. ==>   2236      if (disksize > EXT4_I(inode)->i_disksize) {      
  559.       2237          int err2;
  560.       2238 
  561.       2239          ext4_wb_update_i_disksize(inode, disksize);
  562.       2240          err2 = ext4_mark_inode_dirty(handle, inode);
  563.       2241          if (err2)
  564.       2242              ext4_error(inode->i_sb,
  565.       2243                     "Failed to mark inode %lu dirty",
  566.       2244                     inode->i_ino);
  567.       2245          if (!err)
  568.       2246              err = err2;
  569.  
  570. /linux-3.13.5/fs/ext4/inode.c:2758
  571.       2748       * generic_write_end() will run mark_inode_dirty() if i_size
  572.       2749       * changes.  So let's piggyback the i_disksize mark_inode_dirty
  573.       2750       * into that.
  574.       2751       */
  575.       2752      new_i_size = pos + copied;
  576.       2753      if (copied && new_i_size > EXT4_I(inode)->i_disksize) {
  577.       2754          if (ext4_has_inline_data(inode) ||
  578.       2755              ext4_da_should_update_i_disksize(page, end)) {
  579.       2756              down_write(&EXT4_I(inode)->i_data_sem);
  580.       2757              if (new_i_size > EXT4_I(inode)->i_disksize)
  581. ==>   2758                  EXT4_I(inode)->i_disksize = new_i_size;      
  582.       2759              up_write(&EXT4_I(inode)->i_data_sem);
  583.       2760              /* We need to mark inode dirty even if
  584.       2761               * new_i_size is less that inode->i_size
  585.       2762               * bu greater than i_disksize.(hint delalloc)
  586.       2763               */
  587.       2764              ext4_mark_inode_dirty(handle, inode);
  588.       2765          }
  589.       2766      }
  590.       2767 
  591.       2768      if (write_mode != CONVERT_INLINE_DATA &&
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement