diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
commit | 9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch) | |
tree | dd0a1b3396ae9414f668b0110cc39d11268ad3ed /fs/libfs.c | |
parent | f0230294271f511b41797305b685365a9e569a09 (diff) | |
parent | bdd3536618443809d18868563eeafa63b9d29603 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
"All kinds of stuff this time around; some more notable parts:
- RCU'd vfsmounts handling
- new primitives for coredump handling
- files_lock is gone
- Bruce's delegations handling series
- exportfs fixes
plus misc stuff all over the place"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits)
ecryptfs: ->f_op is never NULL
locks: break delegations on any attribute modification
locks: break delegations on link
locks: break delegations on rename
locks: helper functions for delegation breaking
locks: break delegations on unlink
namei: minor vfs_unlink cleanup
locks: implement delegations
locks: introduce new FL_DELEG lock flag
vfs: take i_mutex on renamed file
vfs: rename I_MUTEX_QUOTA now that it's not used for quotas
vfs: don't use PARENT/CHILD lock classes for non-directories
vfs: pull ext4's double-i_mutex-locking into common code
exportfs: fix quadratic behavior in filehandle lookup
exportfs: better variable name
exportfs: move most of reconnect_path to helper function
exportfs: eliminate unused "noprogress" counter
exportfs: stop retrying once we race with rename/remove
exportfs: clear DISCONNECTED on all parents sooner
exportfs: more detailed comment for path_reconnect
...
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 122 |
1 files changed, 87 insertions, 35 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index 3a3a9b53bf5a..5de06947ba5e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/vfs.h> | 10 | #include <linux/vfs.h> |
11 | #include <linux/quotaops.h> | 11 | #include <linux/quotaops.h> |
12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
13 | #include <linux/namei.h> | ||
13 | #include <linux/exportfs.h> | 14 | #include <linux/exportfs.h> |
14 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
15 | #include <linux/buffer_head.h> /* sync_mapping_buffers */ | 16 | #include <linux/buffer_head.h> /* sync_mapping_buffers */ |
@@ -31,6 +32,7 @@ int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
31 | stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9); | 32 | stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9); |
32 | return 0; | 33 | return 0; |
33 | } | 34 | } |
35 | EXPORT_SYMBOL(simple_getattr); | ||
34 | 36 | ||
35 | int simple_statfs(struct dentry *dentry, struct kstatfs *buf) | 37 | int simple_statfs(struct dentry *dentry, struct kstatfs *buf) |
36 | { | 38 | { |
@@ -39,6 +41,7 @@ int simple_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
39 | buf->f_namelen = NAME_MAX; | 41 | buf->f_namelen = NAME_MAX; |
40 | return 0; | 42 | return 0; |
41 | } | 43 | } |
44 | EXPORT_SYMBOL(simple_statfs); | ||
42 | 45 | ||
43 | /* | 46 | /* |
44 | * Retaining negative dentries for an in-memory filesystem just wastes | 47 | * Retaining negative dentries for an in-memory filesystem just wastes |
@@ -66,6 +69,7 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned | |||
66 | d_add(dentry, NULL); | 69 | d_add(dentry, NULL); |
67 | return NULL; | 70 | return NULL; |
68 | } | 71 | } |
72 | EXPORT_SYMBOL(simple_lookup); | ||
69 | 73 | ||
70 | int dcache_dir_open(struct inode *inode, struct file *file) | 74 | int dcache_dir_open(struct inode *inode, struct file *file) |
71 | { | 75 | { |
@@ -75,12 +79,14 @@ int dcache_dir_open(struct inode *inode, struct file *file) | |||
75 | 79 | ||
76 | return file->private_data ? 0 : -ENOMEM; | 80 | return file->private_data ? 0 : -ENOMEM; |
77 | } | 81 | } |
82 | EXPORT_SYMBOL(dcache_dir_open); | ||
78 | 83 | ||
79 | int dcache_dir_close(struct inode *inode, struct file *file) | 84 | int dcache_dir_close(struct inode *inode, struct file *file) |
80 | { | 85 | { |
81 | dput(file->private_data); | 86 | dput(file->private_data); |
82 | return 0; | 87 | return 0; |
83 | } | 88 | } |
89 | EXPORT_SYMBOL(dcache_dir_close); | ||
84 | 90 | ||
85 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | 91 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) |
86 | { | 92 | { |
@@ -123,6 +129,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | |||
123 | mutex_unlock(&dentry->d_inode->i_mutex); | 129 | mutex_unlock(&dentry->d_inode->i_mutex); |
124 | return offset; | 130 | return offset; |
125 | } | 131 | } |
132 | EXPORT_SYMBOL(dcache_dir_lseek); | ||
126 | 133 | ||
127 | /* Relationship between i_mode and the DT_xxx types */ | 134 | /* Relationship between i_mode and the DT_xxx types */ |
128 | static inline unsigned char dt_type(struct inode *inode) | 135 | static inline unsigned char dt_type(struct inode *inode) |
@@ -172,11 +179,13 @@ int dcache_readdir(struct file *file, struct dir_context *ctx) | |||
172 | spin_unlock(&dentry->d_lock); | 179 | spin_unlock(&dentry->d_lock); |
173 | return 0; | 180 | return 0; |
174 | } | 181 | } |
182 | EXPORT_SYMBOL(dcache_readdir); | ||
175 | 183 | ||
176 | ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos) | 184 | ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos) |
177 | { | 185 | { |
178 | return -EISDIR; | 186 | return -EISDIR; |
179 | } | 187 | } |
188 | EXPORT_SYMBOL(generic_read_dir); | ||
180 | 189 | ||
181 | const struct file_operations simple_dir_operations = { | 190 | const struct file_operations simple_dir_operations = { |
182 | .open = dcache_dir_open, | 191 | .open = dcache_dir_open, |
@@ -186,10 +195,12 @@ const struct file_operations simple_dir_operations = { | |||
186 | .iterate = dcache_readdir, | 195 | .iterate = dcache_readdir, |
187 | .fsync = noop_fsync, | 196 | .fsync = noop_fsync, |
188 | }; | 197 | }; |
198 | EXPORT_SYMBOL(simple_dir_operations); | ||
189 | 199 | ||
190 | const struct inode_operations simple_dir_inode_operations = { | 200 | const struct inode_operations simple_dir_inode_operations = { |
191 | .lookup = simple_lookup, | 201 | .lookup = simple_lookup, |
192 | }; | 202 | }; |
203 | EXPORT_SYMBOL(simple_dir_inode_operations); | ||
193 | 204 | ||
194 | static const struct super_operations simple_super_operations = { | 205 | static const struct super_operations simple_super_operations = { |
195 | .statfs = simple_statfs, | 206 | .statfs = simple_statfs, |
@@ -244,6 +255,7 @@ Enomem: | |||
244 | deactivate_locked_super(s); | 255 | deactivate_locked_super(s); |
245 | return ERR_PTR(-ENOMEM); | 256 | return ERR_PTR(-ENOMEM); |
246 | } | 257 | } |
258 | EXPORT_SYMBOL(mount_pseudo); | ||
247 | 259 | ||
248 | int simple_open(struct inode *inode, struct file *file) | 260 | int simple_open(struct inode *inode, struct file *file) |
249 | { | 261 | { |
@@ -251,6 +263,7 @@ int simple_open(struct inode *inode, struct file *file) | |||
251 | file->private_data = inode->i_private; | 263 | file->private_data = inode->i_private; |
252 | return 0; | 264 | return 0; |
253 | } | 265 | } |
266 | EXPORT_SYMBOL(simple_open); | ||
254 | 267 | ||
255 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 268 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
256 | { | 269 | { |
@@ -263,6 +276,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den | |||
263 | d_instantiate(dentry, inode); | 276 | d_instantiate(dentry, inode); |
264 | return 0; | 277 | return 0; |
265 | } | 278 | } |
279 | EXPORT_SYMBOL(simple_link); | ||
266 | 280 | ||
267 | int simple_empty(struct dentry *dentry) | 281 | int simple_empty(struct dentry *dentry) |
268 | { | 282 | { |
@@ -283,6 +297,7 @@ out: | |||
283 | spin_unlock(&dentry->d_lock); | 297 | spin_unlock(&dentry->d_lock); |
284 | return ret; | 298 | return ret; |
285 | } | 299 | } |
300 | EXPORT_SYMBOL(simple_empty); | ||
286 | 301 | ||
287 | int simple_unlink(struct inode *dir, struct dentry *dentry) | 302 | int simple_unlink(struct inode *dir, struct dentry *dentry) |
288 | { | 303 | { |
@@ -293,6 +308,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry) | |||
293 | dput(dentry); | 308 | dput(dentry); |
294 | return 0; | 309 | return 0; |
295 | } | 310 | } |
311 | EXPORT_SYMBOL(simple_unlink); | ||
296 | 312 | ||
297 | int simple_rmdir(struct inode *dir, struct dentry *dentry) | 313 | int simple_rmdir(struct inode *dir, struct dentry *dentry) |
298 | { | 314 | { |
@@ -304,6 +320,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry) | |||
304 | drop_nlink(dir); | 320 | drop_nlink(dir); |
305 | return 0; | 321 | return 0; |
306 | } | 322 | } |
323 | EXPORT_SYMBOL(simple_rmdir); | ||
307 | 324 | ||
308 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | 325 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, |
309 | struct inode *new_dir, struct dentry *new_dentry) | 326 | struct inode *new_dir, struct dentry *new_dentry) |
@@ -330,6 +347,7 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
330 | 347 | ||
331 | return 0; | 348 | return 0; |
332 | } | 349 | } |
350 | EXPORT_SYMBOL(simple_rename); | ||
333 | 351 | ||
334 | /** | 352 | /** |
335 | * simple_setattr - setattr for simple filesystem | 353 | * simple_setattr - setattr for simple filesystem |
@@ -370,6 +388,7 @@ int simple_readpage(struct file *file, struct page *page) | |||
370 | unlock_page(page); | 388 | unlock_page(page); |
371 | return 0; | 389 | return 0; |
372 | } | 390 | } |
391 | EXPORT_SYMBOL(simple_readpage); | ||
373 | 392 | ||
374 | int simple_write_begin(struct file *file, struct address_space *mapping, | 393 | int simple_write_begin(struct file *file, struct address_space *mapping, |
375 | loff_t pos, unsigned len, unsigned flags, | 394 | loff_t pos, unsigned len, unsigned flags, |
@@ -393,6 +412,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping, | |||
393 | } | 412 | } |
394 | return 0; | 413 | return 0; |
395 | } | 414 | } |
415 | EXPORT_SYMBOL(simple_write_begin); | ||
396 | 416 | ||
397 | /** | 417 | /** |
398 | * simple_write_end - .write_end helper for non-block-device FSes | 418 | * simple_write_end - .write_end helper for non-block-device FSes |
@@ -444,6 +464,7 @@ int simple_write_end(struct file *file, struct address_space *mapping, | |||
444 | 464 | ||
445 | return copied; | 465 | return copied; |
446 | } | 466 | } |
467 | EXPORT_SYMBOL(simple_write_end); | ||
447 | 468 | ||
448 | /* | 469 | /* |
449 | * the inodes created here are not hashed. If you use iunique to generate | 470 | * the inodes created here are not hashed. If you use iunique to generate |
@@ -512,6 +533,7 @@ out: | |||
512 | dput(root); | 533 | dput(root); |
513 | return -ENOMEM; | 534 | return -ENOMEM; |
514 | } | 535 | } |
536 | EXPORT_SYMBOL(simple_fill_super); | ||
515 | 537 | ||
516 | static DEFINE_SPINLOCK(pin_fs_lock); | 538 | static DEFINE_SPINLOCK(pin_fs_lock); |
517 | 539 | ||
@@ -534,6 +556,7 @@ int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *c | |||
534 | mntput(mnt); | 556 | mntput(mnt); |
535 | return 0; | 557 | return 0; |
536 | } | 558 | } |
559 | EXPORT_SYMBOL(simple_pin_fs); | ||
537 | 560 | ||
538 | void simple_release_fs(struct vfsmount **mount, int *count) | 561 | void simple_release_fs(struct vfsmount **mount, int *count) |
539 | { | 562 | { |
@@ -545,6 +568,7 @@ void simple_release_fs(struct vfsmount **mount, int *count) | |||
545 | spin_unlock(&pin_fs_lock); | 568 | spin_unlock(&pin_fs_lock); |
546 | mntput(mnt); | 569 | mntput(mnt); |
547 | } | 570 | } |
571 | EXPORT_SYMBOL(simple_release_fs); | ||
548 | 572 | ||
549 | /** | 573 | /** |
550 | * simple_read_from_buffer - copy data from the buffer to user space | 574 | * simple_read_from_buffer - copy data from the buffer to user space |
@@ -579,6 +603,7 @@ ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos, | |||
579 | *ppos = pos + count; | 603 | *ppos = pos + count; |
580 | return count; | 604 | return count; |
581 | } | 605 | } |
606 | EXPORT_SYMBOL(simple_read_from_buffer); | ||
582 | 607 | ||
583 | /** | 608 | /** |
584 | * simple_write_to_buffer - copy data from user space to the buffer | 609 | * simple_write_to_buffer - copy data from user space to the buffer |
@@ -613,6 +638,7 @@ ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, | |||
613 | *ppos = pos + count; | 638 | *ppos = pos + count; |
614 | return count; | 639 | return count; |
615 | } | 640 | } |
641 | EXPORT_SYMBOL(simple_write_to_buffer); | ||
616 | 642 | ||
617 | /** | 643 | /** |
618 | * memory_read_from_buffer - copy data from the buffer | 644 | * memory_read_from_buffer - copy data from the buffer |
@@ -644,6 +670,7 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | |||
644 | 670 | ||
645 | return count; | 671 | return count; |
646 | } | 672 | } |
673 | EXPORT_SYMBOL(memory_read_from_buffer); | ||
647 | 674 | ||
648 | /* | 675 | /* |
649 | * Transaction based IO. | 676 | * Transaction based IO. |
@@ -665,6 +692,7 @@ void simple_transaction_set(struct file *file, size_t n) | |||
665 | smp_mb(); | 692 | smp_mb(); |
666 | ar->size = n; | 693 | ar->size = n; |
667 | } | 694 | } |
695 | EXPORT_SYMBOL(simple_transaction_set); | ||
668 | 696 | ||
669 | char *simple_transaction_get(struct file *file, const char __user *buf, size_t size) | 697 | char *simple_transaction_get(struct file *file, const char __user *buf, size_t size) |
670 | { | 698 | { |
@@ -696,6 +724,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s | |||
696 | 724 | ||
697 | return ar->data; | 725 | return ar->data; |
698 | } | 726 | } |
727 | EXPORT_SYMBOL(simple_transaction_get); | ||
699 | 728 | ||
700 | ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) | 729 | ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) |
701 | { | 730 | { |
@@ -705,12 +734,14 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size | |||
705 | return 0; | 734 | return 0; |
706 | return simple_read_from_buffer(buf, size, pos, ar->data, ar->size); | 735 | return simple_read_from_buffer(buf, size, pos, ar->data, ar->size); |
707 | } | 736 | } |
737 | EXPORT_SYMBOL(simple_transaction_read); | ||
708 | 738 | ||
709 | int simple_transaction_release(struct inode *inode, struct file *file) | 739 | int simple_transaction_release(struct inode *inode, struct file *file) |
710 | { | 740 | { |
711 | free_page((unsigned long)file->private_data); | 741 | free_page((unsigned long)file->private_data); |
712 | return 0; | 742 | return 0; |
713 | } | 743 | } |
744 | EXPORT_SYMBOL(simple_transaction_release); | ||
714 | 745 | ||
715 | /* Simple attribute files */ | 746 | /* Simple attribute files */ |
716 | 747 | ||
@@ -746,12 +777,14 @@ int simple_attr_open(struct inode *inode, struct file *file, | |||
746 | 777 | ||
747 | return nonseekable_open(inode, file); | 778 | return nonseekable_open(inode, file); |
748 | } | 779 | } |
780 | EXPORT_SYMBOL_GPL(simple_attr_open); | ||
749 | 781 | ||
750 | int simple_attr_release(struct inode *inode, struct file *file) | 782 | int simple_attr_release(struct inode *inode, struct file *file) |
751 | { | 783 | { |
752 | kfree(file->private_data); | 784 | kfree(file->private_data); |
753 | return 0; | 785 | return 0; |
754 | } | 786 | } |
787 | EXPORT_SYMBOL_GPL(simple_attr_release); /* GPL-only? This? Really? */ | ||
755 | 788 | ||
756 | /* read from the buffer that is filled with the get function */ | 789 | /* read from the buffer that is filled with the get function */ |
757 | ssize_t simple_attr_read(struct file *file, char __user *buf, | 790 | ssize_t simple_attr_read(struct file *file, char __user *buf, |
@@ -787,6 +820,7 @@ out: | |||
787 | mutex_unlock(&attr->mutex); | 820 | mutex_unlock(&attr->mutex); |
788 | return ret; | 821 | return ret; |
789 | } | 822 | } |
823 | EXPORT_SYMBOL_GPL(simple_attr_read); | ||
790 | 824 | ||
791 | /* interpret the buffer as a number to call the set function with */ | 825 | /* interpret the buffer as a number to call the set function with */ |
792 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | 826 | ssize_t simple_attr_write(struct file *file, const char __user *buf, |
@@ -819,6 +853,7 @@ out: | |||
819 | mutex_unlock(&attr->mutex); | 853 | mutex_unlock(&attr->mutex); |
820 | return ret; | 854 | return ret; |
821 | } | 855 | } |
856 | EXPORT_SYMBOL_GPL(simple_attr_write); | ||
822 | 857 | ||
823 | /** | 858 | /** |
824 | * generic_fh_to_dentry - generic helper for the fh_to_dentry export operation | 859 | * generic_fh_to_dentry - generic helper for the fh_to_dentry export operation |
@@ -957,39 +992,56 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
957 | { | 992 | { |
958 | return 0; | 993 | return 0; |
959 | } | 994 | } |
960 | |||
961 | EXPORT_SYMBOL(dcache_dir_close); | ||
962 | EXPORT_SYMBOL(dcache_dir_lseek); | ||
963 | EXPORT_SYMBOL(dcache_dir_open); | ||
964 | EXPORT_SYMBOL(dcache_readdir); | ||
965 | EXPORT_SYMBOL(generic_read_dir); | ||
966 | EXPORT_SYMBOL(mount_pseudo); | ||
967 | EXPORT_SYMBOL(simple_write_begin); | ||
968 | EXPORT_SYMBOL(simple_write_end); | ||
969 | EXPORT_SYMBOL(simple_dir_inode_operations); | ||
970 | EXPORT_SYMBOL(simple_dir_operations); | ||
971 | EXPORT_SYMBOL(simple_empty); | ||
972 | EXPORT_SYMBOL(simple_fill_super); | ||
973 | EXPORT_SYMBOL(simple_getattr); | ||
974 | EXPORT_SYMBOL(simple_open); | ||
975 | EXPORT_SYMBOL(simple_link); | ||
976 | EXPORT_SYMBOL(simple_lookup); | ||
977 | EXPORT_SYMBOL(simple_pin_fs); | ||
978 | EXPORT_SYMBOL(simple_readpage); | ||
979 | EXPORT_SYMBOL(simple_release_fs); | ||
980 | EXPORT_SYMBOL(simple_rename); | ||
981 | EXPORT_SYMBOL(simple_rmdir); | ||
982 | EXPORT_SYMBOL(simple_statfs); | ||
983 | EXPORT_SYMBOL(noop_fsync); | 995 | EXPORT_SYMBOL(noop_fsync); |
984 | EXPORT_SYMBOL(simple_unlink); | 996 | |
985 | EXPORT_SYMBOL(simple_read_from_buffer); | 997 | void kfree_put_link(struct dentry *dentry, struct nameidata *nd, |
986 | EXPORT_SYMBOL(simple_write_to_buffer); | 998 | void *cookie) |
987 | EXPORT_SYMBOL(memory_read_from_buffer); | 999 | { |
988 | EXPORT_SYMBOL(simple_transaction_set); | 1000 | char *s = nd_get_link(nd); |
989 | EXPORT_SYMBOL(simple_transaction_get); | 1001 | if (!IS_ERR(s)) |
990 | EXPORT_SYMBOL(simple_transaction_read); | 1002 | kfree(s); |
991 | EXPORT_SYMBOL(simple_transaction_release); | 1003 | } |
992 | EXPORT_SYMBOL_GPL(simple_attr_open); | 1004 | EXPORT_SYMBOL(kfree_put_link); |
993 | EXPORT_SYMBOL_GPL(simple_attr_release); | 1005 | |
994 | EXPORT_SYMBOL_GPL(simple_attr_read); | 1006 | /* |
995 | EXPORT_SYMBOL_GPL(simple_attr_write); | 1007 | * nop .set_page_dirty method so that people can use .page_mkwrite on |
1008 | * anon inodes. | ||
1009 | */ | ||
1010 | static int anon_set_page_dirty(struct page *page) | ||
1011 | { | ||
1012 | return 0; | ||
1013 | }; | ||
1014 | |||
1015 | /* | ||
1016 | * A single inode exists for all anon_inode files. Contrary to pipes, | ||
1017 | * anon_inode inodes have no associated per-instance data, so we need | ||
1018 | * only allocate one of them. | ||
1019 | */ | ||
1020 | struct inode *alloc_anon_inode(struct super_block *s) | ||
1021 | { | ||
1022 | static const struct address_space_operations anon_aops = { | ||
1023 | .set_page_dirty = anon_set_page_dirty, | ||
1024 | }; | ||
1025 | struct inode *inode = new_inode_pseudo(s); | ||
1026 | |||
1027 | if (!inode) | ||
1028 | return ERR_PTR(-ENOMEM); | ||
1029 | |||
1030 | inode->i_ino = get_next_ino(); | ||
1031 | inode->i_mapping->a_ops = &anon_aops; | ||
1032 | |||
1033 | /* | ||
1034 | * Mark the inode dirty from the very beginning, | ||
1035 | * that way it will never be moved to the dirty | ||
1036 | * list because mark_inode_dirty() will think | ||
1037 | * that it already _is_ on the dirty list. | ||
1038 | */ | ||
1039 | inode->i_state = I_DIRTY; | ||
1040 | inode->i_mode = S_IRUSR | S_IWUSR; | ||
1041 | inode->i_uid = current_fsuid(); | ||
1042 | inode->i_gid = current_fsgid(); | ||
1043 | inode->i_flags |= S_PRIVATE; | ||
1044 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
1045 | return inode; | ||
1046 | } | ||
1047 | EXPORT_SYMBOL(alloc_anon_inode); | ||