I just wanted to share a solution after a troubled 2.2 update.
I am using CentoOS 7.2 with SELinux enabled and discovered that my site was not loading. Looking into the exception.log I noticed errors writing to
generated/code/Magento/MediaStorage/Model/File/Storage/ it seems that Magento moves the generated files from var in 2.1 so you will need to set your SELinux permissions appropriately.
sudo semanage fcontext -a -t httpd_sys_rw_content_t "generated(/.*)?"
sudo restorecon -vRF generated/