diff options
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index 275ca4749a2e..c18e9a1235b6 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -16,6 +16,8 @@ | |||
16 | 16 | ||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | 18 | ||
19 | #include "internal.h" | ||
20 | |||
19 | static inline int simple_positive(struct dentry *dentry) | 21 | static inline int simple_positive(struct dentry *dentry) |
20 | { | 22 | { |
21 | return dentry->d_inode && !d_unhashed(dentry); | 23 | return dentry->d_inode && !d_unhashed(dentry); |
@@ -246,13 +248,11 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, | |||
246 | root->i_ino = 1; | 248 | root->i_ino = 1; |
247 | root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; | 249 | root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; |
248 | root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; | 250 | root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; |
249 | dentry = d_alloc(NULL, &d_name); | 251 | dentry = __d_alloc(s, &d_name); |
250 | if (!dentry) { | 252 | if (!dentry) { |
251 | iput(root); | 253 | iput(root); |
252 | goto Enomem; | 254 | goto Enomem; |
253 | } | 255 | } |
254 | dentry->d_sb = s; | ||
255 | dentry->d_parent = dentry; | ||
256 | d_instantiate(dentry, root); | 256 | d_instantiate(dentry, root); |
257 | s->s_root = dentry; | 257 | s->s_root = dentry; |
258 | s->s_d_op = dops; | 258 | s->s_d_op = dops; |
@@ -328,8 +328,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
328 | 328 | ||
329 | if (new_dentry->d_inode) { | 329 | if (new_dentry->d_inode) { |
330 | simple_unlink(new_dir, new_dentry); | 330 | simple_unlink(new_dir, new_dentry); |
331 | if (they_are_dirs) | 331 | if (they_are_dirs) { |
332 | drop_nlink(new_dentry->d_inode); | ||
332 | drop_nlink(old_dir); | 333 | drop_nlink(old_dir); |
334 | } | ||
333 | } else if (they_are_dirs) { | 335 | } else if (they_are_dirs) { |
334 | drop_nlink(old_dir); | 336 | drop_nlink(old_dir); |
335 | inc_nlink(new_dir); | 337 | inc_nlink(new_dir); |
@@ -905,21 +907,29 @@ EXPORT_SYMBOL_GPL(generic_fh_to_parent); | |||
905 | * filesystems which track all non-inode metadata in the buffers list | 907 | * filesystems which track all non-inode metadata in the buffers list |
906 | * hanging off the address_space structure. | 908 | * hanging off the address_space structure. |
907 | */ | 909 | */ |
908 | int generic_file_fsync(struct file *file, int datasync) | 910 | int generic_file_fsync(struct file *file, loff_t start, loff_t end, |
911 | int datasync) | ||
909 | { | 912 | { |
910 | struct inode *inode = file->f_mapping->host; | 913 | struct inode *inode = file->f_mapping->host; |
911 | int err; | 914 | int err; |
912 | int ret; | 915 | int ret; |
913 | 916 | ||
917 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); | ||
918 | if (err) | ||
919 | return err; | ||
920 | |||
921 | mutex_lock(&inode->i_mutex); | ||
914 | ret = sync_mapping_buffers(inode->i_mapping); | 922 | ret = sync_mapping_buffers(inode->i_mapping); |
915 | if (!(inode->i_state & I_DIRTY)) | 923 | if (!(inode->i_state & I_DIRTY)) |
916 | return ret; | 924 | goto out; |
917 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | 925 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) |
918 | return ret; | 926 | goto out; |
919 | 927 | ||
920 | err = sync_inode_metadata(inode, 1); | 928 | err = sync_inode_metadata(inode, 1); |
921 | if (ret == 0) | 929 | if (ret == 0) |
922 | ret = err; | 930 | ret = err; |
931 | out: | ||
932 | mutex_unlock(&inode->i_mutex); | ||
923 | return ret; | 933 | return ret; |
924 | } | 934 | } |
925 | EXPORT_SYMBOL(generic_file_fsync); | 935 | EXPORT_SYMBOL(generic_file_fsync); |
@@ -956,7 +966,7 @@ EXPORT_SYMBOL(generic_check_addressable); | |||
956 | /* | 966 | /* |
957 | * No-op implementation of ->fsync for in-memory filesystems. | 967 | * No-op implementation of ->fsync for in-memory filesystems. |
958 | */ | 968 | */ |
959 | int noop_fsync(struct file *file, int datasync) | 969 | int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
960 | { | 970 | { |
961 | return 0; | 971 | return 0; |
962 | } | 972 | } |