afs: Migrate vlocation fields to 64-bit
[ Upstream commit 8a79790bf0b7da216627ffb85f52cfb4adbf1e4e ] get_seconds() returns real wall-clock seconds. On 32-bit systems this value will overflow in year 2038 and beyond. This patch changes afs's vlocation record to use ktime_get_real_seconds() instead, for the fields time_of_death and update_at. Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9d8d20570f
commit
43e68e3725
4 changed files with 20 additions and 16 deletions
|
@ -362,7 +362,7 @@ static void afs_callback_updater(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct afs_server *server;
|
struct afs_server *server;
|
||||||
struct afs_vnode *vnode, *xvnode;
|
struct afs_vnode *vnode, *xvnode;
|
||||||
time_t now;
|
time64_t now;
|
||||||
long timeout;
|
long timeout;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ static void afs_callback_updater(struct work_struct *work)
|
||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
now = get_seconds();
|
now = ktime_get_real_seconds();
|
||||||
|
|
||||||
/* find the first vnode to update */
|
/* find the first vnode to update */
|
||||||
spin_lock(&server->cb_lock);
|
spin_lock(&server->cb_lock);
|
||||||
|
@ -424,7 +424,8 @@ static void afs_callback_updater(struct work_struct *work)
|
||||||
|
|
||||||
/* and then reschedule */
|
/* and then reschedule */
|
||||||
_debug("reschedule");
|
_debug("reschedule");
|
||||||
vnode->update_at = get_seconds() + afs_vnode_update_timeout;
|
vnode->update_at = ktime_get_real_seconds() +
|
||||||
|
afs_vnode_update_timeout;
|
||||||
|
|
||||||
spin_lock(&server->cb_lock);
|
spin_lock(&server->cb_lock);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/ktime.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
|
@ -247,7 +248,7 @@ struct afs_cache_vhash {
|
||||||
*/
|
*/
|
||||||
struct afs_vlocation {
|
struct afs_vlocation {
|
||||||
atomic_t usage;
|
atomic_t usage;
|
||||||
time_t time_of_death; /* time at which put reduced usage to 0 */
|
time64_t time_of_death; /* time at which put reduced usage to 0 */
|
||||||
struct list_head link; /* link in cell volume location list */
|
struct list_head link; /* link in cell volume location list */
|
||||||
struct list_head grave; /* link in master graveyard list */
|
struct list_head grave; /* link in master graveyard list */
|
||||||
struct list_head update; /* link in master update list */
|
struct list_head update; /* link in master update list */
|
||||||
|
@ -258,7 +259,7 @@ struct afs_vlocation {
|
||||||
struct afs_cache_vlocation vldb; /* volume information DB record */
|
struct afs_cache_vlocation vldb; /* volume information DB record */
|
||||||
struct afs_volume *vols[3]; /* volume access record pointer (index by type) */
|
struct afs_volume *vols[3]; /* volume access record pointer (index by type) */
|
||||||
wait_queue_head_t waitq; /* status change waitqueue */
|
wait_queue_head_t waitq; /* status change waitqueue */
|
||||||
time_t update_at; /* time at which record should be updated */
|
time64_t update_at; /* time at which record should be updated */
|
||||||
spinlock_t lock; /* access lock */
|
spinlock_t lock; /* access lock */
|
||||||
afs_vlocation_state_t state; /* volume location state */
|
afs_vlocation_state_t state; /* volume location state */
|
||||||
unsigned short upd_rej_cnt; /* ENOMEDIUM count during update */
|
unsigned short upd_rej_cnt; /* ENOMEDIUM count during update */
|
||||||
|
@ -271,7 +272,7 @@ struct afs_vlocation {
|
||||||
*/
|
*/
|
||||||
struct afs_server {
|
struct afs_server {
|
||||||
atomic_t usage;
|
atomic_t usage;
|
||||||
time_t time_of_death; /* time at which put reduced usage to 0 */
|
time64_t time_of_death; /* time at which put reduced usage to 0 */
|
||||||
struct in_addr addr; /* server address */
|
struct in_addr addr; /* server address */
|
||||||
struct afs_cell *cell; /* cell in which server resides */
|
struct afs_cell *cell; /* cell in which server resides */
|
||||||
struct list_head link; /* link in cell's server list */
|
struct list_head link; /* link in cell's server list */
|
||||||
|
|
|
@ -237,7 +237,7 @@ void afs_put_server(struct afs_server *server)
|
||||||
spin_lock(&afs_server_graveyard_lock);
|
spin_lock(&afs_server_graveyard_lock);
|
||||||
if (atomic_read(&server->usage) == 0) {
|
if (atomic_read(&server->usage) == 0) {
|
||||||
list_move_tail(&server->grave, &afs_server_graveyard);
|
list_move_tail(&server->grave, &afs_server_graveyard);
|
||||||
server->time_of_death = get_seconds();
|
server->time_of_death = ktime_get_real_seconds();
|
||||||
queue_delayed_work(afs_wq, &afs_server_reaper,
|
queue_delayed_work(afs_wq, &afs_server_reaper,
|
||||||
afs_server_timeout * HZ);
|
afs_server_timeout * HZ);
|
||||||
}
|
}
|
||||||
|
@ -272,9 +272,9 @@ static void afs_reap_server(struct work_struct *work)
|
||||||
LIST_HEAD(corpses);
|
LIST_HEAD(corpses);
|
||||||
struct afs_server *server;
|
struct afs_server *server;
|
||||||
unsigned long delay, expiry;
|
unsigned long delay, expiry;
|
||||||
time_t now;
|
time64_t now;
|
||||||
|
|
||||||
now = get_seconds();
|
now = ktime_get_real_seconds();
|
||||||
spin_lock(&afs_server_graveyard_lock);
|
spin_lock(&afs_server_graveyard_lock);
|
||||||
|
|
||||||
while (!list_empty(&afs_server_graveyard)) {
|
while (!list_empty(&afs_server_graveyard)) {
|
||||||
|
|
|
@ -340,7 +340,8 @@ static void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)
|
||||||
struct afs_vlocation *xvl;
|
struct afs_vlocation *xvl;
|
||||||
|
|
||||||
/* wait at least 10 minutes before updating... */
|
/* wait at least 10 minutes before updating... */
|
||||||
vl->update_at = get_seconds() + afs_vlocation_update_timeout;
|
vl->update_at = ktime_get_real_seconds() +
|
||||||
|
afs_vlocation_update_timeout;
|
||||||
|
|
||||||
spin_lock(&afs_vlocation_updates_lock);
|
spin_lock(&afs_vlocation_updates_lock);
|
||||||
|
|
||||||
|
@ -506,7 +507,7 @@ void afs_put_vlocation(struct afs_vlocation *vl)
|
||||||
if (atomic_read(&vl->usage) == 0) {
|
if (atomic_read(&vl->usage) == 0) {
|
||||||
_debug("buried");
|
_debug("buried");
|
||||||
list_move_tail(&vl->grave, &afs_vlocation_graveyard);
|
list_move_tail(&vl->grave, &afs_vlocation_graveyard);
|
||||||
vl->time_of_death = get_seconds();
|
vl->time_of_death = ktime_get_real_seconds();
|
||||||
queue_delayed_work(afs_wq, &afs_vlocation_reap,
|
queue_delayed_work(afs_wq, &afs_vlocation_reap,
|
||||||
afs_vlocation_timeout * HZ);
|
afs_vlocation_timeout * HZ);
|
||||||
|
|
||||||
|
@ -543,11 +544,11 @@ static void afs_vlocation_reaper(struct work_struct *work)
|
||||||
LIST_HEAD(corpses);
|
LIST_HEAD(corpses);
|
||||||
struct afs_vlocation *vl;
|
struct afs_vlocation *vl;
|
||||||
unsigned long delay, expiry;
|
unsigned long delay, expiry;
|
||||||
time_t now;
|
time64_t now;
|
||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
now = get_seconds();
|
now = ktime_get_real_seconds();
|
||||||
spin_lock(&afs_vlocation_graveyard_lock);
|
spin_lock(&afs_vlocation_graveyard_lock);
|
||||||
|
|
||||||
while (!list_empty(&afs_vlocation_graveyard)) {
|
while (!list_empty(&afs_vlocation_graveyard)) {
|
||||||
|
@ -622,13 +623,13 @@ static void afs_vlocation_updater(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct afs_cache_vlocation vldb;
|
struct afs_cache_vlocation vldb;
|
||||||
struct afs_vlocation *vl, *xvl;
|
struct afs_vlocation *vl, *xvl;
|
||||||
time_t now;
|
time64_t now;
|
||||||
long timeout;
|
long timeout;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
now = get_seconds();
|
now = ktime_get_real_seconds();
|
||||||
|
|
||||||
/* find a record to update */
|
/* find a record to update */
|
||||||
spin_lock(&afs_vlocation_updates_lock);
|
spin_lock(&afs_vlocation_updates_lock);
|
||||||
|
@ -684,7 +685,8 @@ static void afs_vlocation_updater(struct work_struct *work)
|
||||||
|
|
||||||
/* and then reschedule */
|
/* and then reschedule */
|
||||||
_debug("reschedule");
|
_debug("reschedule");
|
||||||
vl->update_at = get_seconds() + afs_vlocation_update_timeout;
|
vl->update_at = ktime_get_real_seconds() +
|
||||||
|
afs_vlocation_update_timeout;
|
||||||
|
|
||||||
spin_lock(&afs_vlocation_updates_lock);
|
spin_lock(&afs_vlocation_updates_lock);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue