summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre
Commit message (Collapse)AuthorAgeFilesLines
* staging: lustre: delete the filesystem from the tree.Greg Kroah-Hartman2018-06-05205-133378/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Lustre filesystem has been in the kernel tree for over 5 years now. While it has been an endless source of enjoyment for new kernel developers learning how to do basic codingstyle cleanups, as well as an semi-entertaining source of bewilderment from the vfs developers any time they have looked into the codebase to try to figure out how to port their latest api changes to this filesystem, it has not really moved forward into the "this is in shape to get out of staging" despite many half-completed attempts. And getting code out of staging is the main goal of that portion of the kernel tree. Code should not stagnate and it feels like having this code in staging is only causing the development cycle of the filesystem to take longer than it should. There is a whole separate out-of-tree copy of this codebase where the developers work on it, and then random changes are thrown over the wall at staging at some later point in time. This dual-tree development model has never worked, and the state of this codebase is proof of that. So, let's just delete the whole mess. Now the lustre developers can go off and work in their out-of-tree codebase and not have to worry about providing valid changelog entries and breaking their patches up into logical pieces. They can take the time they have spend doing those types of housekeeping chores and get the codebase into a much better shape, and it can be submitted for inclusion into the real part of the kernel tree when ready. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: get rid of ldebugfs_remove()Greg Kroah-Hartman2018-06-0111-58/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | It was just a dumb wrapper around debugfs_remove_recursive() so just call the function properly. Also, there is no need to set the dentry to NULL, it's gone, who cares about it anymore... Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Roman Storozhenko <romeusmeister@gmail.com> Cc: Aastha Gupta <aastha.gupta4104@gmail.com> Cc: Ben Evans <bevans@cray.com> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Patrick Farrell <paf@cray.com> Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: Andriy Skulysh <andriy.skulysh@seagate.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: Bob Glosman <bob.glossman@intel.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: make ldebugfs_add_vars a void functionGreg Kroah-Hartman2018-06-018-94/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The call to ldebugfs_add_vars() can not really fail, so have it just return nothing, which allows us to clean up a lot of unused error handling code. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Roman Storozhenko <romeusmeister@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Aastha Gupta <aastha.gupta4104@gmail.com> Cc: Ben Evans <bevans@cray.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Frank Zago <fzago@cray.com> Cc: Patrick Farrell <paf@cray.com> Cc: Simo Koskinen <koskisoft@gmail.com> Cc: Andriy Skulysh <andriy.skulysh@seagate.com> Cc: "John L. Hammond" <john.hammond@intel.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove last two users of ldebugfs_register()Greg Kroah-Hartman2018-06-015-61/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | ldebugfs_register() is just a call to debugfs_create_dir() and ldebugfs_add_vars() if the list option is set. Fix up the last two users of this function to just call these two functions instead, and delete the now unused ldebugfs_register() call. This ends up cleaning up more code and making things smaller, always a good thing. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Ben Evans <bevans@cray.com> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: Patrick Farrell <paf@cray.com> Cc: Nadav Amit <namit@vmware.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: unwrap some ldebugfs_register() callsGreg Kroah-Hartman2018-06-018-93/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the third option (list) to ldebugfs_register() is NULL, it's the same as just calling debugfs_create_dir(). So unwind this and call debugfs_create_dir() directly. This ends up saving lots of code as we do not need to do any error checking of the return value (because it does not matter). The ldebugfs_register() call will be removed in a later patch when it is fully removed, right now there are 2 outstanding users of it in the tree. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Aastha Gupta <aastha.gupta4104@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Patrick Farrell <paf@cray.com> Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com> Cc: "John L. Hammond" <john.hammond@intel.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: Andriy Skulysh <andriy.skulysh@seagate.com> Cc: Ben Evans <bevans@cray.com> Cc: Bob Glosman <bob.glossman@intel.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove ldebugfs_obd_seq_create() wrapper functionGreg Kroah-Hartman2018-06-015-42/+8
| | | | | | | | | | | | | | | | | | | | | | | It was just calling debugfs_create_file() so unwind things and just call the real function instead. This ends up saving a number of lines as there was never any error handling happening anyway, so that all can be removed as well. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Ben Evans <bevans@cray.com> Cc: NeilBrown <neilb@suse.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: Roman Storozhenko <romeusmeister@gmail.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove ldebugfs_seq_create() wrapper functionGreg Kroah-Hartman2018-06-017-63/+21
| | | | | | | | | | | | | | | | | | | | | | | | | It was just calling debugfs_create_file() so unwind things and just call the real function instead. This ends up saving a number of lines as there was never any error handling happening anyway, so that all can be removed as well. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: NeilBrown <neilb@suse.com> Cc: Ben Evans <bevans@cray.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: "John L. Hammond" <john.hammond@intel.com> Cc: Vitaly Fertman <vitaly.fertman@seagate.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: Bob Glosman <bob.glossman@intel.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove ldebugfs_register_stats() wrapper functionGreg Kroah-Hartman2018-06-015-38/+16
| | | | | | | | | | | | | | | | | | | | | | | | | It was just calling debugfs_create_file() so unwind things and just call the real function instead. This ends up saving a number of lines as there was never any error handling happening anyway, so that all can be removed as well. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: Ben Evans <bevans@cray.com> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: NeilBrown <neilb@suse.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Patrick Farrell <paf@cray.com> Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com> Cc: Aastha Gupta <aastha.gupta4104@gmail.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: Bob Glosman <bob.glossman@intel.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove ldebugfs_add_simple() wrapperGreg Kroah-Hartman2018-06-013-40/+5
| | | | | | | | | | | | | | | | | | | | | It was only being called in one place, and is an unneeded wrapper function around debugfs_create_file() so just call the real debugfs function instead. This ends up cleaning up some unneeded error handling logic that was never needed as well. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Ben Evans <bevans@cray.com> Cc: NeilBrown <neilb@suse.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: no need to check debugfs return valuesGreg Kroah-Hartman2018-06-012-28/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Clean up the lustre core code by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed. Note, more work is needed to remove the unneeded debugfs wrapper functions in the future. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Ben Evans <bevans@cray.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: "John L. Hammond" <john.hammond@intel.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: mdc: excessive memory consumption by the xattr cacheAndrew Perepechko2018-05-311-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The refill operation of the xattr cache does not know the reply size in advance, so it makes a guess based on the maxeasize value returned by the MDS. In practice, it allocates 16 KiB for the common case and 4 MiB for the large xattr case. However, a typical reply is just a few hundred bytes. If we follow the conservative approach, we can prepare a single memory page for the reply. It is large enough for any reasonable xattr set and, at the same time, it does not require multiple page memory reclaim, which can be costly. If, for a specific file, the reply is larger than a single page, the client is prepared to handle that and will fall back to non-cached xattr code. Indeed, if this happens often and xattrs are often used to store large values, it makes sense to disable the xattr cache at all since it wasn't designed for such [mis]use. Signed-off-by: Andrew Perepechko <c17827@cray.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9417 Reviewed-on: https://review.whamcloud.com/26887 Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Ben Evans <bevans@cray.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: acl: increase ACL entries limitationFan Yong2018-05-317-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, the limitation of ACL entries is 32, that is not enough for some use cases. In fact, restricting ACL entries count is mainly for preparing the RPC reply buffer to receive the ACL data. So we cannot make the ACL entries count to be unlimited. But we can enlarge the RPC reply buffer to hold more ACL entries. On the other hand, MDT backend filesystem has its own EA size limitation. For example, for ldiskfs case, if large EA enable, then the max ACL size is 1048492 bytes; otherwise, it is 4012 bytes. For ZFS backend, such value is 32768 bytes. With such hard limitation, we can calculate how many ACL entries we can have at most. This patch increases the RPC reply buffer to match such hard limitation. For old client, to avoid buffer overflow because of large ACL data (more than 32 ACL entries), the MDT will forbid the old client to access the file with large ACL data. As for how to know whether it is old client or new, a new connection flag OBD_CONNECT_LARGE_ACL is used for that. Signed-off-by: Fan Yong <fan.yong@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7473 Reviewed-on: https://review.whamcloud.com/19790 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Li Xi <lixi@ddn.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: remove unused parameters from md_{get, set}xattr()John L. Hammond2018-05-317-49/+46
| | | | | | | | | | | | | | md_getxattr() and md_setxattr() each have several unused parameters. Remove them and improve the naming or remaining parameters. Signed-off-by: John L. Hammond <john.hammond@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10792 Reviewed-on: https://review.whamcloud.com/ Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: add support set_acl method in inode operationsDmitry Eremin2018-05-312-0/+59
| | | | | | | | | | | | | | | | | | | | | | Linux kernel v3.14 adds set_acl method to inode operations. This patch adds support to Lustre for proper acl management. Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com> Signed-off-by: John L. Hammond <john.hammond@intel.com> Signed-off-by: James Simmons <uja.ornl@yahoo.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183 Reviewed-on: https://review.whamcloud.com/25965 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10541 Reviewed-on: https://review.whamcloud.com/31588 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10926 Reviewed-on: https://review.whamcloud.com/32045 Reviewed-by: Bob Glossman <bob.glossman@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: create acl.c fileJames Simmons2018-05-314-13/+58
| | | | | | | | | Move ll_get_acl() to its own file acl.c just like all the other linux file systems do. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fix more build errors in errno.cGreg Kroah-Hartman2018-05-261-0/+2
| | | | | | | | | | And we need even more .h files to be included to build this file. So add kernel.h and module.h, and hopefully that's enough... Reported-by: kbuild test robot <lkp@intel.com> Fixes: 0922c0084b91 ("staging: lustre: remove libcfs_all from ptlrpc") Cc: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fix build error in errno.cGreg Kroah-Hartman2018-05-261-0/+1
| | | | | | | | | | Turns out we need some more .h files to build properly on all arches. Specifically errno.h for this file. Reported-by: kbuild test robot <lkp@intel.com> Fixes: 0922c0084b91 ("staging: lustre: remove libcfs_all from ptlrpc") Cc: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fix build error in mdc_request.cGreg Kroah-Hartman2018-05-261-0/+1
| | | | | | | | | | Turns out we need some more .h files to build properly on all arches. Specifically prefetch.h for this file. Reported-by: kbuild test robot <lkp@intel.com> Fixes: 73d65c8d1a85 ("staging: lustre: remove libcfs_all.h from lustre/include/*.h") Cc: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove remaining libcfs_all.h includes from lustre/lustreNeilBrown2018-05-2518-22/+4
| | | | | | | Most of these aren't needed, a few can be simplified. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove libcfs_all.h from fid, fld, obdclassNeilBrown2018-05-2512-15/+0
| | | | | | | None of these files seem to nee libcfs_all.h Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove libcfs_all from ptlrpcNeilBrown2018-05-2514-18/+15
| | | | | | | | Some files didn't need it at all, others just needed one or two includes. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove libcfs_all.h from remaining .h files.NeilBrown2018-05-2510-8/+5
| | | | | | | Now no *.h files include libcfs_all.h - only *.c files. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove libcfs_all.h from lustre/include/*.hNeilBrown2018-05-2529-13/+31
| | | | | | | | Instead of the catch-all libcfs_all.h, just include the files actually needed in different places. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: start moving includes out of libcfs.hNeilBrown2018-05-2561-61/+61
| | | | | | | | | | | | | | | | Lots of places include libcfs.h, and it includes lots of other include files. Many of these aren't needed in many places. It is tidier and better documentation to just include what is needed. So remove all the includes from libcfs.h and create libcfs_all.h which contains them. Then change every reference to libcfs.h to instead include libcfs_all.h Next several patches will remove that from various files in small batches Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: replace memory_presure funcitons by standard interfaces.NeilBrown2018-05-254-10/+15
| | | | | | | | Use memalloc_noreclaim_save() and memalloc_noreclaim_restore(), and for testing, just directly test the flag in current->flags Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: discard cfs_block_sigsinv()NeilBrown2018-05-252-15/+20
| | | | | | | | | | | | | | cfs_block_sigsinv() and cfs_restore_sigs() are simple wrappers which save a couple of line of code and hurt readability for people not familiar with them. They aren't used often enough to be worthwhile, so discard them and open-code the functionality. The sigorsets() call isn't needed as or-ing with current->blocked is exactly what sigprocmask(SIG_BLOCK) does. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: discard CFS_TICKNeilBrown2018-05-253-3/+3
| | | | | | | | | | | | | | | This undocumented macro seems to represent "a small amount of time". Sometimes it is used as-is, some times it is multiplied by 5 for no obvious reason. It does not appear that there is any connection between the different places it is used - they all just want a short period for different purposes and of different durarions. So discard CFS_TICK and lets each use-site just use whatever number of jiffies seems appropriate in that case. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: discard cfs_cap_t, use kernel_cap_tNeilBrown2018-05-2511-23/+24
| | | | | | | | | | | | | | | | | | lustre only sends 32bits of capabilities in on-the-wire RPC calls. It current strips off higher bits and uses a 32bit cfs_cap_t throughout. Though there is a small memory cost, it is cleaner to use kernel_cap_t throughout and only truncate when marshalling data for RPC calls. So this patch replaces cfs_cap_t with kernel_cap_t throughout, and where a cfs_cap_t was previous stored in a __u32, we now store cap.cap[0] instead. With this, we can remove include/linux/libcfs/curproc.h Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: simplify capability dropping.NeilBrown2018-05-251-5/+3
| | | | | | | | | | | | | | | | | | | | Lustre has a 'squash credentials' concept similar to the "anon_uid" for nfsd. When accessing a file with squashed credentials, we need to also drop capabilities. Linux has cap_drop_fs_set() and cap_drop_nfsd_set(). Rather than taking a completely different approach, this patch changes lustre to use this same cap_drop_*_set() approach. With this change we also drop CAP_MKNOD and CAP_MAC_OVERRIDE which are probably appropriate, and don't drop CAP_SYS_ADMIN or CAP_SYS_BOOT which should be irrelevant for file permission checking Calling both cap_drop_*_set() seems a bit clumsy, but gets the job done. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: remove current_pid() and current_comm()NeilBrown2018-05-259-18/+18
| | | | | | | | Just use current->pid and current->comm directly, instead of having wrappers. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: rename cfs_cpt_table to cfs_cpt_tabNeilBrown2018-05-253-10/+10
| | | | | | | | | | | The variable "cfs_cpt_table" has the same name as the structure "struct cfs_cpt_table". This makes it hard to use #define to make one disappear on a uni-processor build, but keep the other. So rename the variable to cfs_cpt_tab. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: refactor libcfs initialization.NeilBrown2018-05-2511-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many lustre modules depend on libcfs having initialized properly, but do not explicit check that it did. When lustre is built as discrete modules, this does not cause a problem because if the libcfs module fails initialization, the other modules don't even get loaded. When lustre is compiled into the kernel, all module_init() routines get run, so they need to check the required initialization succeeded. This patch splits out the initialization of libcfs into a new libcfs_setup(), and has all modules call that. The misc_register() call is kept separate as it does not allocate any resources and if it fails, it fails hard - no point in retrying. Other set-up allocates resources and so is best delayed until they are needed, and can be worth retrying. Ideally, the initialization would happen at mount time (or similar) rather than at load time. Doing this requires each module to check dependencies when they are activated rather than when they are loaded. Achieving that is a much larger job that would have to progress in stages. For now, this change ensures that if some initialization in libcfs fails, other modules will fail-safe. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: osc: tidy up osc_init()NeilBrown2018-05-251-13/+16
| | | | | | | | | | | | A module_init() function that registers the services of the module should do that last, after all other initialization has succeeded. This patch moves the class_register_type() call to the end and ensures everything else that might have been set up, is cleaned up on error. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: obdclass: change object lookup to no wait modeLai Siyao2018-05-151-30/+9
| | | | | | | | | | | | | | | | | | | | | | Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want to remove object from cache, but this may lead to deadlock, because when other process lookup such object, it needs to wait for this object until release (done at last refcount put), while that process maybe already hold an LDLM lock. Now that current code can handle dying object correctly, we can just return such object in lookup, thus the above deadlock can be avoided. Signed-off-by: Lai Siyao <lai.siyao@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9049 Reviewed-on: https://review.whamcloud.com/26965 Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Tested-by: Cliff White <cliff.white@intel.com> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Reviewed-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: Use 'kvfree()' for memory allocated by 'kvzalloc()'Christophe JAILLET2018-05-141-1/+1
| | | | | | | | | 'buf' is allocated with 'kvzalloc()'. 'kvfree()' must be used to free it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Fixes: 11c647caf74b ("staging: lustre: obdclass: variable llog chunk size") Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: Fix an error handling path in 'client_common_fill_super()'Christophe JAILLET2018-05-141-2/+2
| | | | | | | | | According to error handling path before and after this one, we should go to 'out_md_fid' here, instead of 'out_md', if 'obd_connect()' fails. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fix spelling mistake: "req_ulinked" -> "req_unlinked"Colin Ian King2018-05-141-1/+1
| | | | | | | | Trivial fix to spelling mistake in DEBUG_REQ message text Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fix error deref in ll_splice_alias().NeilBrown2018-05-081-2/+7
| | | | | | | | | | | | | | | d_splice_alias() can return an ERR_PTR(). If it does while debugging is enabled, the following CDEBUG() will dereference that error and crash. So add appropriate checking, and provide a separate debug message for the error case. Reported-and-tested-by: James Simmons <jsimmons@infradead.org> Fixes: e9d4f0b9f559 ("staging: lustre: llite: use d_splice_alias for directories.") Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: remove redundant lookup in dump_pgcacheNeilBrown2018-05-081-57/+41
| | | | | | | | | | | | | | | | | | | | Both the 'next' and the 'show' functions for the dump_page_cache seqfile perform a lookup based on the current file index. This is needless duplication. The reason appears to be that the state that needs to be communicated from "next" to "show" is two pointers, but seq_file only provides for a single pointer to be returned from next and passed to show. So make use of the new 'seq_private' structure to store the extra pointer. So when 'next' (or 'start') find something, it returns the page and stores the clob in the private area. 'show' accepts the page as an argument, and finds the clob where it was stored. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: use more private data in dump_pgcacheNeilBrown2018-05-081-76/+72
| | | | | | | | | | | | | | | | | The dump_page_cache debugfs file allocates and frees an 'env' in each call to vvp_pgcache_start,next,show. This is likely to be fast, but does introduce the need to check for errors. It is reasonable to allocate a single 'env' when the file is opened, and use that throughout. So create 'seq_private' structure which stores the sbi, env, and refcheck, and attach this to the seqfile. Then use it throughout instead of allocating 'env' repeatedly. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: fold lu_object_new() into lu_object_find_at()NeilBrown2018-05-081-32/+12
| | | | | | | | | | | lu_object_new() duplicates a lot of code that is in lu_object_find_at(). There is no real need for a separate function, it is simpler just to skip the bits of lu_object_find_at() that we don't want in the LOC_F_NEW case. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: lu_object: move retry logic inside htable_lookupNeilBrown2018-05-081-43/+27
| | | | | | | | | | | | | | | | | | | | | The current retry logic, to wait when a 'dying' object is found, spans multiple functions. The process is attached to a waitqueue and set TASK_UNINTERRUPTIBLE in htable_lookup, and this status is passed back through lu_object_find_try() to lu_object_find_at() where schedule() is called and the process is removed from the queue. This can be simplified by moving all the logic (including hashtable locking) inside htable_lookup(), which now never returns EAGAIN. Note that htable_lookup() is called with the hash bucket lock held, and will drop and retake it if it needs to schedule. I made this a 'goto' loop rather than a 'while(1)' loop as the diff is easier to read. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: lu_object: discard extra lru count.NeilBrown2018-05-081-15/+12
| | | | | | | | | | | | | | | | | | | lu_object maintains 2 lru counts. One is a per-bucket lsb_lru_len. The other is the per-cpu ls_lru_len_counter. The only times the per-bucket counters are use are: - a debug message when an object is added - in lu_site_stats_get when all the counters are combined. The debug message is not essential, and the per-cpu counter can be used to get the combined total. So discard the per-bucket lsb_lru_len. Reviewed-by: Andreas Dilger <andreas.dilger@dilger.ca> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: make struct lu_site_bkt_data privateNeilBrown2018-05-084-48/+55
| | | | | | | | | | | | This data structure only needs to be public so that various modules can access a wait queue to wait for object destruction. If we provide a function to get the wait queue, rather than the whole bucket, the structure can be made private. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: obdclass: guarantee all keys filledHongchao Zhang2018-05-061-4/+25
| | | | | | | | | | | | | | | | | | | | | | | In keys_fill, the key_set_version could be changed after the keys are filled, then the keys in this context won't be refilled by the following lu_context_refill for its version is equal to the current key_set_version. In lu_context_refill, the key_set_version should be protected before comparing it to version stored in the lu_context. Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8346 Reviewed-on: https://review.whamcloud.com/26099 Reviewed-on: https://review.whamcloud.com/27448 Reviewed-on: https://review.whamcloud.com/27994 Reviewed-by: Patrick Farrell <paf@cray.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Mike Pershin <mike.pershin@intel.com> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: obdclass: hoist locking in lu_context_exit()John L. Hammond2018-05-061-5/+7
| | | | | | | | | | | | | Hoist lu_keys_guard locking out of the for loop in lu_context_exit(). Signed-off-by: John L. Hammond <john.hammond@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8918 Reviewed-on: https://review.whamcloud.com/24217 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: obdclass: change spinlock of key to rwlockLi Xi2018-05-061-19/+19
| | | | | | | | | | | | | | | Most of the time, keys are never changed. So rwlock might be better for the concurrency of key read. Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Gu Zheng <gzheng@ddn.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6800 Reviewed-on: http://review.whamcloud.com/15558 Reviewed-by: Faccini Bruno <bruno.faccini@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: llite: fix potential missing-check bug when copying lumvWenwen Wang2018-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | In ll_dir_ioctl(), the object lumv3 is firstly copied from the user space using Its address, i.e., lumv1 = &lumv3. If the lmm_magic field of lumv3 is LOV_USER_MAGIC_V3, lumv3 will be modified by the second copy from the user space. The second copy is necessary, because the two versions (i.e., lov_user_md_v1 and lov_user_md_v3) have different data formats and lengths. However, given that the user data resides in the user space, a malicious user-space process can race to change the data between the two copies. By doing so, the attacker can provide a data with an inconsistent version, e.g., v1 version + v3 data. This can lead to logical errors in the following execution in ll_dir_setstripe(), which performs different actions according to the version specified by the field lmm_magic. This patch rechecks the version field lmm_magic in the second copy. If the version is not as expected, i.e., LOV_USER_MAGIC_V3, an error code will be returned: -EINVAL. Signed-off-by: Wenwen Wang <wang6495@umn.edu> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: ldlm: store name directly in namespace.NeilBrown2018-05-062-1/+9
| | | | | | | | | | | | Rather than storing the name of a namespace in the hash table, store it directly in the namespace. This will allow the hashtable to be changed to use rhashtable. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: James Simmons <jsimmons@infradead.org> Reviewed-by: Andreas Dilger <andreas.dilger@dilger.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: lustre: add container_of_safe()NeilBrown2018-04-2313-37/+37
| | | | | | | | | | | | | | | | | | | | | Luster has a container_of0() function which is similar to container_of() but passes an IS_ERR_OR_NULL() pointer through unchanged. This could be generally useful: bcache at last has a similar function. Naming is hard, but the precedent set by hlist_entry_safe() suggests a _safe suffix might be most consistent. So add container_of_safe() to kernel.h, and replace all occurrences of container_of0() with one of - list_first_entry, list_next_entry, when that is a better fit, - container_of(), when the pointer is used as a validpointer in surrounding code, - container_of_safe() when there is no obviously better alternative. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud